public MachineCode(string s) { var str = s.Split(); sign = str[0] == "1"; displace = MachineCodeFormatter.RemoveExtededZerosAtTheEnd(MachineCodeFormatter.GetBoolMatrix(str[1])); binary_code = MachineCodeFormatter.RemoveExtededZerosAtTheEnd(MachineCodeFormatter.GetBoolMatrix(str[2])); }
public static int CompareBoolMatrix(bool[] mx_1, bool[] mx_2) { mx_1 = MachineCodeFormatter.RemoveExtededZerosAtTheEnd(mx_1); mx_2 = MachineCodeFormatter.RemoveExtededZerosAtTheEnd(mx_2); if (mx_1.Length != mx_2.Length) { return((mx_1.Length > mx_2.Length) ? 1 : -1); } for (int i = mx_1.Length - 1; i >= 0; i--) { if (mx_1[i] != mx_2[i]) { return(mx_1[i].CompareTo(mx_2[i])); } } return(0); }