Advertisement
godzcheater

Bits

Feb 1st, 2012
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1.         public static System.Boolean[] ByteToBits(System.Byte InByte)
  2.         {
  3.             System.Boolean[] xReturn = new System.Boolean[8];
  4.             for (System.Int32 i = 0; i < 8; i++)
  5.             {
  6.                 xReturn[i] = (InByte & (128 >> i)) != 0;
  7.             }
  8.             return xReturn;
  9.         }
  10.         public static System.Boolean GetBit(System.Byte InByte, System.Int32 BitIndex)
  11.         {
  12.             return (InByte & (128 >> BitIndex)) != 0;
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement