Table of Contents

Method ClearBits

Namespace
KZDev.PerfUtils
Assembly
KZDev.PerfUtils.dll

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 int

A variable containing the bits to clear. The result is stored in this variable.

clearBitsValue int

The value that holds the bits to clear in location1. All the bits set in this value will be cleared 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 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 uint

A variable containing the bits to clear. The result is stored in this variable.

clearBitsValue uint

The value that holds the bits to clear in location1. All the bits set in this value will be cleared 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 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 long

A variable containing the bits to clear. The result is stored in this variable.

clearBitsValue long

The value that holds the bits to clear in location1. All the bits set in this value will be cleared 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 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 ulong

A variable containing the bits to clear. The result is stored in this variable.

clearBitsValue ulong

The value that holds the bits to clear in location1. All the bits set in this value will be cleared 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 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.