public static uint160 operator ++(uint160 a) { var ret = new uint160(a); return a + new uint160(1); }
public ScriptId(uint160 value) : base(value) { }
public static uint160 operator |(uint160 a, uint160 b) { var n = new uint160(a); for(int i = 0 ; i < WIDTH ; i++) n.pn[i] |= b.pn[i]; return n; }
public static uint160 operator >>(uint160 a, int shift) { var result = new uint160(); int k = shift / 32; shift = shift % 32; for(int i = 0 ; i < WIDTH ; i++) { if(i - k - 1 >= 0 && shift != 0) result.pn[i - k - 1] |= (a.pn[i] << (32 - shift)); if(i - k >= 0) result.pn[i - k] |= (a.pn[i] >> shift); } return result; }
private static int Comparison(uint160 a, uint160 b) { if (a.pn4 < b.pn4) return -1; if (a.pn4 > b.pn4) return 1; if (a.pn3 < b.pn3) return -1; if (a.pn3 > b.pn3) return 1; if (a.pn2 < b.pn2) return -1; if (a.pn2 > b.pn2) return 1; if (a.pn1 < b.pn1) return -1; if (a.pn1 > b.pn1) return 1; if (a.pn0 < b.pn0) return -1; if (a.pn0 > b.pn0) return 1; return 0; }
public static uint160 operator ^(uint160 a, uint160 b) { var c = new uint160(); c.pn = new uint[a.pn.Length]; for(int i = 0 ; i < c.pn.Length ; i++) { c.pn[i] = a.pn[i] ^ b.pn[i]; } return c; }
public WitKeyId(uint160 value) : base(value.ToBytes()) { }
public uint160(uint160 b) { pn0 = b.pn0; pn1 = b.pn1; pn2 = b.pn2; pn3 = b.pn3; pn4 = b.pn4; }
public static uint160 Parse(string hex) { var ret = new uint160(); ret.SetHex(hex); return ret; }
public static bool TryParse(string hex, out uint160 result) { if(hex == null) throw new ArgumentNullException("hex"); result = null; if(hex.Length != WIDTH_BYTE * 2) return false; if(!((HexEncoder)Encoders.Hex).IsValid(hex)) return false; var ret = new uint160(); ret.SetHex(hex); result = ret; return true; }
public uint160(uint160 b) { for(int i = 0 ; i < WIDTH ; i++) pn[i] = b.pn[i]; }
public static uint160 operator ++(uint160 a) { var ret = new uint160(a); return(a + new uint160(1)); }
public TxDestination(uint160 value) : this(value.ToBytes()) { }
public ScriptId(uint160 value) : base(value.ToBytes()) { }
public void ReadWrite(BitcoinStream stream) { if(stream.Serializing) { var b = Value.ToBytes(); stream.ReadWrite(ref b); } else { byte[] b = new byte[WIDTH_BYTE]; stream.ReadWrite(ref b); _Value = new uint160(b); } }
public static bool TryParse(string hex, out uint160 result) { if(hex == null) throw new ArgumentNullException("hex"); if (hex.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) hex = hex.Substring(2); result = null; if(hex.Length != WIDTH_BYTE * 2) return false; if(!((HexEncoder)Encoders.Hex).IsValid(hex)) return false; result = new uint160(hex); return true; }
private static int Comparison(uint160 a, uint160 b) { for (int i = WIDTH-1; i >= 0; i--) { if (a.pn[i] < b.pn[i]) return -1; else if (a.pn[i] > b.pn[i]) return 1; } return 0; }
public MutableUint160() { _Value = uint160.Zero; }
public static uint160 operator+(uint160 a, uint160 b) { var result = new uint160(); ulong carry = 0; for (int i = 0; i < WIDTH; i++) { ulong n = carry + a.pn[i] + b.pn[i]; result.pn[i] = (uint)(n & 0xffffffff); carry = n >> 32; } return result; }
public MutableUint160() { this._Value = Zero; }
public static uint160 operator <<(uint160 a, int shift) { var result = new uint160(); int k = shift / 32; shift = shift % 32; for(int i = 0 ; i < WIDTH ; i++) { if(i + k + 1 < WIDTH && shift != 0) result.pn[i + k + 1] |= (a.pn[i] >> (32 - shift)); if(i + k < WIDTH) result.pn[i + k] |= (a.pn[i] << shift); } return result; }
public MutableUint160(uint160 value) { this._Value = value; }
public static uint160 operator -(uint160 a) { var b = new uint160(); for(int i = 0 ; i < b.pn.Length ; i++) { b.pn[i] = ~a.pn[i]; } b++; return b; }
public KeyId(uint160 value) : base(value) { }
public MutableUint160(uint160 value) { _Value = value; }