Method SetBits
SetBits(ref int, int)
A thread-safe method to set a specific set of bits in a variable.
public static (int originalValue, int newValue) SetBits(ref int location1, int setBitsValue)
Parameters
location1
intA variable containing the bits to set. The result is stored in this variable.
setBitsValue
intThe value that holds the bits to set and store in
location1
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 uses the Or(ref int, int) operation to set the bits, and returns the original and new values.
SetBits(ref uint, uint)
A thread-safe method to set a specific set of bits in a variable.
public static (uint originalValue, uint newValue) SetBits(ref uint location1, uint setBitsValue)
Parameters
location1
uintA variable containing the bits to set. The result is stored in this variable.
setBitsValue
uintThe value that holds the bits to set and store in
location1
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 uses the Or(ref int, int) operation to set the bits, and returns the original and new values.
SetBits(ref long, long)
A thread-safe method to set a specific set of bits in a variable.
public static (long originalValue, long newValue) SetBits(ref long location1, long setBitsValue)
Parameters
location1
longA variable containing the bits to set. The result is stored in this variable.
setBitsValue
longThe value that holds the bits to set and store in
location1
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 uses the Or(ref int, int) operation to set the bits, and returns the original and new values.
SetBits(ref ulong, ulong)
A thread-safe method to set a specific set of bits in a variable.
public static (ulong originalValue, ulong newValue) SetBits(ref ulong location1, ulong setBitsValue)
Parameters
location1
ulongA variable containing the bits to set. The result is stored in this variable.
setBitsValue
ulongThe value that holds the bits to set and store in
location1
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 uses the Or(ref int, int) operation to set the bits, and returns the original and new values.