首页 > TAG信息列表 > GetBit

C#获取比特位

/// /// 获取字节中的指定Bit的值 /// /// 字节 /// Bit的索引值(0-7) /// public int GetBit(byte test, int index) { byte x = 1; switch (index) { case 0: { x = 0x01; } break; case 1: { x = 0x02; } break; case 2: { x = 0x04; } break; case 3: { x = 0x08; } break