コード例 #1
0
        public void RightBlockShiftTest()
        {
            Random random = new Random(1234);

            UInt32[] mantissa = UIntUtil.Random(random, BigUInt <Pow2.N32> .Length, BigUInt <Pow2.N32> .Bits);

            BigUInt <Pow2.N32> v  = new BigUInt <Pow2.N32>(mantissa, enable_clone: false);
            BigInteger         bi = v;

            for (int sft = 0; sft <= BigUInt <Pow2.N32> .Length + 4; sft++)
            {
                BigUInt <Pow2.N32> v_sft = BigUInt <Pow2.N32> .RightBlockShift(v, sft);

                BigInteger bi_sft = bi >> (sft * UIntUtil.UInt32Bits);

                Console.WriteLine(sft);
                Console.WriteLine(v.ToHexcode());
                Console.WriteLine(v_sft.ToHexcode());
                Assert.AreEqual(bi_sft, v_sft);

                Console.Write("\n");
            }
        }
コード例 #2
0
 public static Accumulator <N> RightBlockShift(Accumulator <N> n, int sft)
 {
     return(new Accumulator <N>(BigUInt <Double <N> > .RightBlockShift(n.value, sft)));
 }
コード例 #3
0
 public static Mantissa <N> RightBlockShift(Mantissa <N> n, int sft)
 {
     return(new Mantissa <N>(BigUInt <N> .RightBlockShift(n.value, sft)));
 }