Method ClearBits
ClearBits(ref int, int)
A thread-safe method to clear a specific set of bits in a variable.
public static (int originalValue, int newValue) ClearBits(ref int location1, int clearBitsValue)
Parameters
location1
intA variable containing the bits to clear. The result is stored in this variable.
clearBitsValue
intThe value that holds the bits to clear in
location1
. All the bits set in this value will be cleared inlocation1
.
Returns
- (int originalValue, int newValue)
A tuple containing the original value and the new value after the operation.
Remarks
This is a convenience method that could be done with And(ref int, int)
passing the bitwise complement of the clearBitsValue
, but this
method returns the original and new values in a tuple.
ClearBits(ref uint, uint)
A thread-safe method to clear a specific set of bits in a variable.
public static (uint originalValue, uint newValue) ClearBits(ref uint location1, uint clearBitsValue)
Parameters
location1
uintA variable containing the bits to clear. The result is stored in this variable.
clearBitsValue
uintThe value that holds the bits to clear in
location1
. All the bits set in this value will be cleared inlocation1
.
Returns
- (uint originalValue, uint newValue)
A tuple containing the original value and the new value after the operation.
Remarks
This is a convenience method that could be done with And(ref int, int)
passing the bitwise complement of the clearBitsValue
, but this
method returns the original and new values in a tuple.
ClearBits(ref long, long)
A thread-safe method to clear a specific set of bits in a variable.
public static (long originalValue, long newValue) ClearBits(ref long location1, long clearBitsValue)
Parameters
location1
longA variable containing the bits to clear. The result is stored in this variable.
clearBitsValue
longThe value that holds the bits to clear in
location1
. All the bits set in this value will be cleared inlocation1
.
Returns
- (long originalValue, long newValue)
A tuple containing the original value and the new value after the operation.
Remarks
This is a convenience method that could be done with And(ref int, int)
passing the bitwise complement of the clearBitsValue
, but this
method returns the original and new values in a tuple.
ClearBits(ref ulong, ulong)
A thread-safe method to clear a specific set of bits in a variable.
public static (ulong originalValue, ulong newValue) ClearBits(ref ulong location1, ulong clearBitsValue)
Parameters
location1
ulongA variable containing the bits to clear. The result is stored in this variable.
clearBitsValue
ulongThe value that holds the bits to clear in
location1
. All the bits set in this value will be cleared inlocation1
.
Returns
- (ulong originalValue, ulong newValue)
A tuple containing the original value and the new value after the operation.
Remarks
This is a convenience method that could be done with And(ref int, int)
passing the bitwise complement of the clearBitsValue
, but this
method returns the original and new values in a tuple.