예제 #1
0
        public void Extension_Crystalize_Int32_NegativeTwo()
        {
            Byte[]    source = new byte[3];
            BitWindow window = new BitWindow(source, 3, 5, EndianBitIndexer.NativeBitIndexer);

            for (int bitIdx = 0; bitIdx < window.Length; bitIdx++)
            {
                window[bitIdx] = true;
            }
            window[0] = false;
            Assert.AreEqual(-2, BitConverter.ToInt32(window.Crystalize(IntegerFormat.S32), 0));
        }
예제 #2
0
        public void Extension_Crystalize_Int32_EnsureByteOrder()
        {
            byte[]    source = new byte[5];
            BitWindow window = new BitWindow(source, 3, 16, EndianBitIndexer.NativeBitIndexer);

            for (Int32 bitIdx = 8; bitIdx < 16; bitIdx++)
            {
                window[bitIdx] = true;
            }

            byte[] intBuffer = window.Crystalize(IntegerFormat.S32);
            Assert.AreEqual(unchecked ((Int32)0xffffff00), BitConverter.ToInt32(intBuffer, 0));
        }