public static VLong Parse(string data, bool isHex) { //int segSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(uint)) * 2; System.Globalization.NumberStyles style = isHex ? System.Globalization.NumberStyles.AllowHexSpecifier : System.Globalization.NumberStyles.None; int pos = 0; VLong ret = new VLong(); while (pos < data.Length) { ret *= 0x100; uint piece = uint.Parse( data.Substring(pos, 2), style); ret.Add(piece); pos += 2; } return(ret); }
public static VLong operator -(VLong left, VLong right) { VLong result = null; if (left.negative != right.negative) { result = new VLong(left); result.Add(right); } else if (left.Compare(right) >= 0) { result = new VLong(left); result.Subtract(right); } else { result = new VLong(right); result.Subtract(left); result.negative = 1 - result.negative; } return(result); }