예제 #1
0
        public void TestSetBits2()
        {
            byte[] array = new byte[5];
            array[3] = 0x00;
            BitsUtil.SetBits(array, 3, 7, 0, 0x0E3);
            Assert.AreEqual(array[3], 0xE3);

            Assert.AreEqual(0xE3, BitsUtil.GetBits(array, 3, 7, 0));
        }
예제 #2
0
        public void TestSetBits1()
        {
            byte[] array = new byte[5];
            array[3] = 0x99;
            BitsUtil.SetBits(array, 3, 4, 2, 0x02);
            Assert.AreEqual(array[3], 0x89);

            Assert.AreEqual(0x02, BitsUtil.GetBits(array, 3, 4, 2));
        }
예제 #3
0
파일: Util.cs 프로젝트: DaBlick/PCG-Tools
 /// <summary>
 /// Only use for fixed parameters or special usage.
 /// </summary>
 /// <returns></returns>
 public static int GetBits(byte[] data, int offset, int highBit, int lowBit)
 {
     return(BitsUtil.GetBits(data, offset, highBit, lowBit));
 }