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
location1intA variable containing the bits to set. The result is stored in this variable.
setBitsValueintThe 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
location1uintA variable containing the bits to set. The result is stored in this variable.
setBitsValueuintThe 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
location1longA variable containing the bits to set. The result is stored in this variable.
setBitsValuelongThe 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
location1ulongA variable containing the bits to set. The result is stored in this variable.
setBitsValueulongThe 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.