Example #1
0
 /// <summary>Modifies bits in a byte value</summary>
 /// <param name="Value">value to modify</param>
 /// <param name="ClearBits">Bit mask of bits in value to clear</param>
 /// <param name="SetBits">Bit mask of bits in value to set</param>
 public static void ModifyBits(ref byte Value, Bits8 ClearBits, Bits8 SetBits)
 {
     Value = ( byte )( ( Value & ( byte )( ~ClearBits ) ) | ( byte )SetBits );
 }
Example #2
0
 /// <summary>Tests if any of the bits specified are set in a value</summary>
 /// <param name="Value">Value to test bits in</param>
 /// <param name="TestBits">Bit mask of bits to test in Value</param>
 /// <returns>true if any of the bits specified in TestBits is set in Value</returns>
 public static bool AnyBitsSet(byte Value, Bits8 TestBits)
 {
     return 0 != ((byte)TestBits & Value);
 }
Example #3
0
 /// <summary>Tests if all the specified bits are set in a Value</summary>
 /// <param name="Value">Value to test</param>
 /// <param name="TestBits">Bit mask of bits to test in Value</param>
 /// <returns>true, if ALL the bits specified in TestBits are set</returns>
 public static bool AllBitsSet(byte Value, Bits8 TestBits)
 {
     return (byte)TestBits == ((byte)TestBits & Value);
 }
Example #4
0
 /// <summary>Tests if any of the bits specified are set in a value</summary>
 /// <param name="Value">Value to test bits in</param>
 /// <param name="TestBits">Bit mask of bits to test in Value</param>
 /// <returns>true if any of the bits specified in TestBits is set in Value</returns>
 public static bool AnyBitsSet(byte Value, Bits8 TestBits)
 {
     return(0 != ((byte)TestBits & Value));
 }
Example #5
0
 /// <summary>Tests if all the specified bits are set in a Value</summary>
 /// <param name="Value">Value to test</param>
 /// <param name="TestBits">Bit mask of bits to test in Value</param>
 /// <returns>true, if ALL the bits specified in TestBits are set</returns>
 public static bool AllBitsSet(byte Value, Bits8 TestBits)
 {
     return((byte)TestBits == ((byte)TestBits & Value));
 }
Example #6
0
 /// <summary>Modifies bits in a byte value</summary>
 /// <param name="Value">value to modify</param>
 /// <param name="ClearBits">Bit mask of bits in value to clear</param>
 /// <param name="SetBits">Bit mask of bits in value to set</param>
 public static void ModifyBits(ref byte Value, Bits8 ClearBits, Bits8 SetBits)
 {
     Value = ( byte )((Value & ( byte )(~ClearBits)) | ( byte )SetBits);
 }