Пример #1
0
        public static Int128 Create(long low, long high)
        {
            Int128 c;

            UInt128.Create(out c.v, (ulong)low, (ulong)high);
            return(c);
        }
Пример #2
0
            /// <summary>
            /// Gets the hash of a byte array.
            /// </summary>
            /// <param name="bytes">The bytes.</param>
            /// <param name="seed">The seed.</param>
            /// <returns>The hash.</returns>
            public UInt192 GetHash(byte[] bytes, UInt192 seed)
            {
                UInt128 hash128 = MurmurHash3.Hash128(bytes, bytes.Length, UInt128.Create(seed.GetLow(), seed.GetMid()));
                ulong   hash64  = MurmurHash3.Hash64(bytes, bytes.Length, seed.GetHigh());

                return(UInt192.Create(hash128.GetLow(), hash128.GetHigh(), hash64));
            }
Пример #3
0
    public IpAddressV6(byte octet0, byte octet1, byte octet2, byte octet3, byte octet4, byte octet5, byte octet6, byte octet7, byte octet8, byte octet9, byte octet10, byte octet11, byte octet12, byte octet13, byte octet14, byte octet15)
    {
        uint u0 = (uint)(octet0 << 24) | (uint)(octet1 << 16) | (uint)(octet2 << 8) | octet3;
        uint u1 = (uint)(octet4 << 24) | (uint)(octet5 << 16) | (uint)(octet6 << 8) | octet7;
        uint u2 = (uint)(octet8 << 24) | (uint)(octet9 << 16) | (uint)(octet10 << 8) | octet11;
        uint u3 = (uint)(octet12 << 24) | (uint)(octet13 << 16) | (uint)(octet14 << 8) | octet15;

        UInt128.Create(out _address, u0, u1, u2, u3);
    }
Пример #4
0
    public IpAddressV6(ushort tuple0, ushort tuple1, ushort tuple2, ushort tuple3, ushort tuple4, ushort tuple5, ushort tuple6, ushort tuple7)
    {
        uint u0 = (uint)(tuple0 << 16) | tuple1;
        uint u1 = (uint)(tuple2 << 16) | tuple3;
        uint u2 = (uint)(tuple4 << 16) | tuple5;
        uint u3 = (uint)(tuple6 << 16) | tuple7;

        UInt128.Create(out _address, u0, u1, u2, u3);
    }
Пример #5
0
 /// <summary>
 /// Gets the hash of a byte array.
 /// </summary>
 /// <param name="bytes">The bytes.</param>
 /// <param name="seed">The seed.</param>
 /// <returns>The hash.</returns>
 public static UInt128 GetHash(byte[] bytes, UInt128 seed)
 {
     // TODO: Have MurmurHash3 work on Span<T> instead.
     Microsoft.Azure.Documents.UInt128 hash128 = Microsoft.Azure.Documents.Routing.MurmurHash3.Hash128(
         bytes,
         bytes.Length,
         Microsoft.Azure.Documents.UInt128.Create(seed.GetLow(), seed.GetHigh()));
     return(UInt128.Create(hash128.GetLow(), hash128.GetHigh()));
 }
Пример #6
0
Файл: int128.cs Проект: sgf/SCTP
 public static bool TryParse(string value, NumberStyles style, IFormatProvider format, out Int128 result)
 {
     BigInteger a;
     if (!BigInteger.TryParse(value, style, format, out a))
     {
         result = Int128.Zero;
         return false;
     }
     UInt128.Create(out result.v, a);
     return true;
 }
Пример #7
0
 public IpAddressV6(ulong addressHigh, ulong addressLow)
 {
     UInt128.Create(out _address, addressHigh, addressLow);
 }
Пример #8
0
 public Int128(BigInteger value)
 {
     UInt128.Create(out v, value);
 }
Пример #9
0
 public Int128(decimal value)
 {
     UInt128.Create(out v, value);
 }
Пример #10
0
 public Int128(double value)
 {
     UInt128.Create(out v, value);
 }
Пример #11
0
 public Int128(ulong value)
 {
     UInt128.Create(out v, value);
 }
Пример #12
0
 public ScUInt128(ulong value)
 {
     UInt128.Create(out this.value, value ^ k0, k1);
 }
Пример #13
0
 public ScUInt128(UInt128 value)
 {
     UInt128.Create(out this.value, value.S0 ^ k0, value.S1 ^ k1);
 }