public void TestCreateUIntMask() { var uciStream = new UciStream(); var mask = Bitwise.CreateUIntMask(7, 11); uciStream.WriteMessageLine(Bitwise.ToString(mask)); Assert.That(Bitwise.ToString(mask), Is.EqualTo("00000000_00000000_00001111_10000000")); }
// Castling Bits // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 // K|Q|k|q // K = White Castle Kingside // Q = White Castle Queenside // k = Black Castle Kingside // q = Black Castle Queenside static Castling() { // Create bit shifts and masks. _shifts = new[] { new[] { 2, 3 }, new[] { 0, 1 } }; _masks = new[] { new[] { Bitwise.CreateUIntMask(2), Bitwise.CreateUIntMask(3) }, new[] { Bitwise.CreateUIntMask(0), Bitwise.CreateUIntMask(1) } }; _unmasks = new[] { new[] { Bitwise.CreateUIntUnmask(2), Bitwise.CreateUIntUnmask(3) }, new[] { Bitwise.CreateUIntUnmask(0), Bitwise.CreateUIntUnmask(1) } }; }