Example #1
0
        public static void countbits_in_memory()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 8; i++)
            {
                byte[] test = new byte[((Random32)rng).NextInt(1, 10_000_000)];
Example #2
0
        public static void sbyte16()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte16 x = rng.NextSByte16();
                byte16  n = rng.NextByte16();

                Assert.AreEqual(new sbyte16((sbyte)_intpow(x.x0, n.x0),
                                            (sbyte)_intpow(x.x1, n.x1),
                                            (sbyte)_intpow(x.x2, n.x2),
                                            (sbyte)_intpow(x.x3, n.x3),
                                            (sbyte)_intpow(x.x4, n.x4),
                                            (sbyte)_intpow(x.x5, n.x5),
                                            (sbyte)_intpow(x.x6, n.x6),
                                            (sbyte)_intpow(x.x7, n.x7),
                                            (sbyte)_intpow(x.x8, n.x8),
                                            (sbyte)_intpow(x.x9, n.x9),
                                            (sbyte)_intpow(x.x10, n.x10),
                                            (sbyte)_intpow(x.x11, n.x11),
                                            (sbyte)_intpow(x.x12, n.x12),
                                            (sbyte)_intpow(x.x13, n.x13),
                                            (sbyte)_intpow(x.x14, n.x14),
                                            (sbyte)_intpow(x.x15, n.x15)),
                                maxmath.intpow(x, n));
            }
        }
Example #3
0
        public static void byte16()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte16 x = rng.NextByte16();

                Assert.AreEqual(new byte16((byte)_intsqrt(x.x0),
                                           (byte)_intsqrt(x.x1),
                                           (byte)_intsqrt(x.x2),
                                           (byte)_intsqrt(x.x3),
                                           (byte)_intsqrt(x.x4),
                                           (byte)_intsqrt(x.x5),
                                           (byte)_intsqrt(x.x6),
                                           (byte)_intsqrt(x.x7),
                                           (byte)_intsqrt(x.x8),
                                           (byte)_intsqrt(x.x9),
                                           (byte)_intsqrt(x.x10),
                                           (byte)_intsqrt(x.x11),
                                           (byte)_intsqrt(x.x12),
                                           (byte)_intsqrt(x.x13),
                                           (byte)_intsqrt(x.x14),
                                           (byte)_intsqrt(x.x15)),
                                maxmath.intsqrt(x));
            }
        }
Example #4
0
        public static void sbyte16()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte16 x = rng.NextSByte16();

                Assert.AreEqual(new sbyte16((sbyte)maxmath.lzcnt(x.x0),
                                            (sbyte)maxmath.lzcnt(x.x1),
                                            (sbyte)maxmath.lzcnt(x.x2),
                                            (sbyte)maxmath.lzcnt(x.x3),
                                            (sbyte)maxmath.lzcnt(x.x4),
                                            (sbyte)maxmath.lzcnt(x.x5),
                                            (sbyte)maxmath.lzcnt(x.x6),
                                            (sbyte)maxmath.lzcnt(x.x7),
                                            (sbyte)maxmath.lzcnt(x.x8),
                                            (sbyte)maxmath.lzcnt(x.x9),
                                            (sbyte)maxmath.lzcnt(x.x10),
                                            (sbyte)maxmath.lzcnt(x.x11),
                                            (sbyte)maxmath.lzcnt(x.x12),
                                            (sbyte)maxmath.lzcnt(x.x13),
                                            (sbyte)maxmath.lzcnt(x.x14),
                                            (sbyte)maxmath.lzcnt(x.x15)),
                                maxmath.lzcnt(x));
            }
        }
Example #5
0
        public static void byte16()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte16 x = rng.NextByte16();
                byte16 y = rng.NextByte16();

                Assert.AreEqual(new byte16((byte)_gcd(x.x0, y.x0),
                                           (byte)_gcd(x.x1, y.x1),
                                           (byte)_gcd(x.x2, y.x2),
                                           (byte)_gcd(x.x3, y.x3),
                                           (byte)_gcd(x.x4, y.x4),
                                           (byte)_gcd(x.x5, y.x5),
                                           (byte)_gcd(x.x6, y.x6),
                                           (byte)_gcd(x.x7, y.x7),
                                           (byte)_gcd(x.x8, y.x8),
                                           (byte)_gcd(x.x9, y.x9),
                                           (byte)_gcd(x.x10, y.x10),
                                           (byte)_gcd(x.x11, y.x11),
                                           (byte)_gcd(x.x12, y.x12),
                                           (byte)_gcd(x.x13, y.x13),
                                           (byte)_gcd(x.x14, y.x14),
                                           (byte)_gcd(x.x15, y.x15)),
                                maxmath.gcd(x, y));
            }
        }
Example #6
0
        public static void byte4()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte4 x = rng.NextByte4();

                Assert.AreEqual(new byte4((byte)_intsqrt(x.x), (byte)_intsqrt(x.y), (byte)_intsqrt(x.z), (byte)_intsqrt(x.w)), maxmath.intsqrt(x));
            }
        }
Example #7
0
        public static void sbyte2()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte2 x = rng.NextSByte2();

                Assert.AreEqual(new sbyte2((sbyte)maxmath.lzcnt(x.x), (sbyte)maxmath.lzcnt(x.y)), maxmath.lzcnt(x));
            }
        }
Example #8
0
        public static void byte3()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte3 x = rng.NextByte3();

                Assert.AreEqual(new byte3((byte)maxmath.lzcnt(x.x), (byte)maxmath.lzcnt(x.y), (byte)maxmath.lzcnt(x.z)), maxmath.lzcnt(x));
            }
        }
Example #9
0
        public static void sbyte4()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte4 x = rng.NextSByte4();
                sbyte4 y = rng.NextSByte4();

                Assert.AreEqual(new byte4((byte)_gcd(x.x, y.x), (byte)_gcd(x.y, y.y), (byte)_gcd(x.z, y.z), (byte)_gcd(x.w, y.w)), maxmath.gcd(x, y));
            }
        }
Example #10
0
        public static void byte3()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte3 x = rng.NextByte3();
                byte3 y = rng.NextByte3();

                Assert.AreEqual(new byte3((byte)_gcd(x.x, y.x), (byte)_gcd(x.y, y.y), (byte)_gcd(x.z, y.z)), maxmath.gcd(x, y));
            }
        }
Example #11
0
        public static void sbyte4()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte4 x = rng.NextSByte4();
                byte4  n = rng.NextByte4();

                Assert.AreEqual(new sbyte4((sbyte)_intpow(x.x, n.x), (sbyte)_intpow(x.y, n.y), (sbyte)_intpow(x.z, n.z), (sbyte)_intpow(x.w, n.w)), maxmath.intpow(x, n));
            }
        }
Example #12
0
        public static void sbyte32()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte32 x = rng.NextSByte32();
                byte32  n = rng.NextByte32();

                Assert.AreEqual(new sbyte32((sbyte)_intpow(x.x0, n.x0),
                                            (sbyte)_intpow(x.x1, n.x1),
                                            (sbyte)_intpow(x.x2, n.x2),
                                            (sbyte)_intpow(x.x3, n.x3),
                                            (sbyte)_intpow(x.x4, n.x4),
                                            (sbyte)_intpow(x.x5, n.x5),
                                            (sbyte)_intpow(x.x6, n.x6),
                                            (sbyte)_intpow(x.x7, n.x7),
                                            (sbyte)_intpow(x.x8, n.x8),
                                            (sbyte)_intpow(x.x9, n.x9),
                                            (sbyte)_intpow(x.x10, n.x10),
                                            (sbyte)_intpow(x.x11, n.x11),
                                            (sbyte)_intpow(x.x12, n.x12),
                                            (sbyte)_intpow(x.x13, n.x13),
                                            (sbyte)_intpow(x.x14, n.x14),
                                            (sbyte)_intpow(x.x15, n.x15),
                                            (sbyte)_intpow(x.x16, n.x16),
                                            (sbyte)_intpow(x.x17, n.x17),
                                            (sbyte)_intpow(x.x18, n.x18),
                                            (sbyte)_intpow(x.x19, n.x19),
                                            (sbyte)_intpow(x.x20, n.x20),
                                            (sbyte)_intpow(x.x21, n.x21),
                                            (sbyte)_intpow(x.x22, n.x22),
                                            (sbyte)_intpow(x.x23, n.x23),
                                            (sbyte)_intpow(x.x24, n.x24),
                                            (sbyte)_intpow(x.x25, n.x25),
                                            (sbyte)_intpow(x.x26, n.x26),
                                            (sbyte)_intpow(x.x27, n.x27),
                                            (sbyte)_intpow(x.x28, n.x28),
                                            (sbyte)_intpow(x.x29, n.x29),
                                            (sbyte)_intpow(x.x30, n.x30),
                                            (sbyte)_intpow(x.x31, n.x31)),
                                maxmath.intpow(x, n));
            }
        }
Example #13
0
        public static void byte32()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte32 x = rng.NextByte32();
                byte32 y = rng.NextByte32();

                Assert.AreEqual(new byte32((byte)_gcd(x.x0, y.x0),
                                           (byte)_gcd(x.x1, y.x1),
                                           (byte)_gcd(x.x2, y.x2),
                                           (byte)_gcd(x.x3, y.x3),
                                           (byte)_gcd(x.x4, y.x4),
                                           (byte)_gcd(x.x5, y.x5),
                                           (byte)_gcd(x.x6, y.x6),
                                           (byte)_gcd(x.x7, y.x7),
                                           (byte)_gcd(x.x8, y.x8),
                                           (byte)_gcd(x.x9, y.x9),
                                           (byte)_gcd(x.x10, y.x10),
                                           (byte)_gcd(x.x11, y.x11),
                                           (byte)_gcd(x.x12, y.x12),
                                           (byte)_gcd(x.x13, y.x13),
                                           (byte)_gcd(x.x14, y.x14),
                                           (byte)_gcd(x.x15, y.x15),
                                           (byte)_gcd(x.x16, y.x16),
                                           (byte)_gcd(x.x17, y.x17),
                                           (byte)_gcd(x.x18, y.x18),
                                           (byte)_gcd(x.x19, y.x19),
                                           (byte)_gcd(x.x20, y.x20),
                                           (byte)_gcd(x.x21, y.x21),
                                           (byte)_gcd(x.x22, y.x22),
                                           (byte)_gcd(x.x23, y.x23),
                                           (byte)_gcd(x.x24, y.x24),
                                           (byte)_gcd(x.x25, y.x25),
                                           (byte)_gcd(x.x26, y.x26),
                                           (byte)_gcd(x.x27, y.x27),
                                           (byte)_gcd(x.x28, y.x28),
                                           (byte)_gcd(x.x29, y.x29),
                                           (byte)_gcd(x.x30, y.x30),
                                           (byte)_gcd(x.x31, y.x31)),
                                maxmath.gcd(x, y));
            }
        }
Example #14
0
        public static void byte32()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte32 x = rng.NextByte32();

                Assert.AreEqual(new byte32((byte)_intsqrt(x.x0),
                                           (byte)_intsqrt(x.x1),
                                           (byte)_intsqrt(x.x2),
                                           (byte)_intsqrt(x.x3),
                                           (byte)_intsqrt(x.x4),
                                           (byte)_intsqrt(x.x5),
                                           (byte)_intsqrt(x.x6),
                                           (byte)_intsqrt(x.x7),
                                           (byte)_intsqrt(x.x8),
                                           (byte)_intsqrt(x.x9),
                                           (byte)_intsqrt(x.x10),
                                           (byte)_intsqrt(x.x11),
                                           (byte)_intsqrt(x.x12),
                                           (byte)_intsqrt(x.x13),
                                           (byte)_intsqrt(x.x14),
                                           (byte)_intsqrt(x.x15),
                                           (byte)_intsqrt(x.x16),
                                           (byte)_intsqrt(x.x17),
                                           (byte)_intsqrt(x.x18),
                                           (byte)_intsqrt(x.x19),
                                           (byte)_intsqrt(x.x20),
                                           (byte)_intsqrt(x.x21),
                                           (byte)_intsqrt(x.x22),
                                           (byte)_intsqrt(x.x23),
                                           (byte)_intsqrt(x.x24),
                                           (byte)_intsqrt(x.x25),
                                           (byte)_intsqrt(x.x26),
                                           (byte)_intsqrt(x.x27),
                                           (byte)_intsqrt(x.x28),
                                           (byte)_intsqrt(x.x29),
                                           (byte)_intsqrt(x.x30),
                                           (byte)_intsqrt(x.x31)),
                                maxmath.intsqrt(x));
            }
        }
Example #15
0
        public static void byte8()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                byte8 x = rng.NextByte8();

                Assert.AreEqual(new byte8((byte)maxmath.lzcnt(x.x0),
                                          (byte)maxmath.lzcnt(x.x1),
                                          (byte)maxmath.lzcnt(x.x2),
                                          (byte)maxmath.lzcnt(x.x3),
                                          (byte)maxmath.lzcnt(x.x4),
                                          (byte)maxmath.lzcnt(x.x5),
                                          (byte)maxmath.lzcnt(x.x6),
                                          (byte)maxmath.lzcnt(x.x7)),
                                maxmath.lzcnt(x));
            }
        }
Example #16
0
        public static void sbyte8()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte8 x = rng.NextSByte8();
                sbyte8 y = rng.NextSByte8();

                Assert.AreEqual(new byte8((byte)_gcd(x.x0, y.x0),
                                          (byte)_gcd(x.x1, y.x1),
                                          (byte)_gcd(x.x2, y.x2),
                                          (byte)_gcd(x.x3, y.x3),
                                          (byte)_gcd(x.x4, y.x4),
                                          (byte)_gcd(x.x5, y.x5),
                                          (byte)_gcd(x.x6, y.x6),
                                          (byte)_gcd(x.x7, y.x7)),
                                maxmath.gcd(x, y));
            }
        }
Example #17
0
        public static void sbyte8()
        {
            Random8 rng = new Random8(135);

            for (int i = 0; i < 64; i++)
            {
                sbyte8 x = rng.NextSByte8();
                byte8  n = rng.NextByte8();

                Assert.AreEqual(new sbyte8((sbyte)_intpow(x.x0, n.x0),
                                           (sbyte)_intpow(x.x1, n.x1),
                                           (sbyte)_intpow(x.x2, n.x2),
                                           (sbyte)_intpow(x.x3, n.x3),
                                           (sbyte)_intpow(x.x4, n.x4),
                                           (sbyte)_intpow(x.x5, n.x5),
                                           (sbyte)_intpow(x.x6, n.x6),
                                           (sbyte)_intpow(x.x7, n.x7)),
                                maxmath.intpow(x, n));
            }
        }