示例#1
0
        public static bool Diff(uint[] x, int xOff, uint[] y, int yOff, uint[] z, int zOff)
        {
            bool flag = Nat128.Gte(x, xOff, y, yOff);

            if (flag)
            {
                Nat128.Sub(x, xOff, y, yOff, z, zOff);
            }
            else
            {
                Nat128.Sub(y, yOff, x, xOff, z, zOff);
            }
            return(flag);
        }
示例#2
0
        public static ulong[] FromBigInteger64(BigInteger x)
        {
            if (x.SignValue < 0 || x.BitLength > 128)
            {
                throw new ArgumentException();
            }
            ulong[] array = Nat128.Create64();
            int     num   = 0;

            while (x.SignValue != 0)
            {
                array[num++] = (ulong)x.LongValue;
                x            = x.ShiftRight(64);
            }
            return(array);
        }
示例#3
0
        public static uint[] FromBigInteger(BigInteger x)
        {
            if (x.SignValue < 0 || x.BitLength > 128)
            {
                throw new ArgumentException();
            }
            uint[] array = Nat128.Create();
            int    num   = 0;

            while (x.SignValue != 0)
            {
                array[num++] = (uint)x.IntValue;
                x            = x.ShiftRight(32);
            }
            return(array);
        }