Method | Description | |
---|---|---|
CountBitsCleared ( uint value ) : int |
Counts the number of bits that are not set
|
|
CountBitsCleared ( ulong value ) : int |
Counts the number of bits that are not set
|
|
CountBitsSet ( uint value ) : int |
Counts the number of bits that are set
|
|
CountBitsSet ( ulong value ) : int |
Counts the number of bits that are set
|
|
CountLeadingOnes ( uint value ) : int |
Counts the number of consecutive 1's starting from the highest bit working down.
|
|
CountLeadingOnes ( ulong value ) : int |
Counts the number of consecutive 1's starting from the highest bit working down.
|
|
CountLeadingZeros ( uint value ) : int |
Counts the number of consecutive 0's starting from the highest bit working down. Unfortunately, c# cannot call the cpu instruction clz Example from http://en.wikipedia.org/wiki/Find_first_set |
|
CountLeadingZeros ( ulong value ) : int |
Counts the number of consecutive 0's starting from the highest bit working down. Unfortunately, c# cannot call the cpu instruction clz Example from http://en.wikipedia.org/wiki/Find_first_set |
|
CountTrailingOnes ( uint value ) : int |
Counts the number of consecutive 1's starting from the lowest bit working up.
|
|
CountTrailingOnes ( ulong value ) : int |
Counts the number of consecutive 1's starting from the lowest bit working up.
|
|
CountTrailingZeros ( uint value ) : int |
Counts the number of consecutive 0's starting from the lowest bit working up. Unfortunately, c# cannot call the cpu instruction ctz Example from http://en.wikipedia.org/wiki/Find_first_set |
|
CountTrailingZeros ( ulong value ) : int |
Counts the number of consecutive 0's starting from the lowest bit working up. Unfortunately, c# cannot call the cpu instruction ctz Example from http://en.wikipedia.org/wiki/Find_first_set |
|
CreateBitMask ( int bitCount ) : ulong |
Creates a bit mask for a number with the given number of bits.
|
|
GetClearedBitPositions ( uint value ) : IEnumerable |
Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-31;
|
|
GetClearedBitPositions ( ulong value ) : IEnumerable |
Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-63;
|
|
GetSetBitPositions ( uint value ) : IEnumerable |
Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-31;
|
|
GetSetBitPositions ( ulong value ) : IEnumerable |
Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-63;
|
|
IsPowerOfTwo ( int value ) : bool |
Determines if the number is a power of 2.
|
|
IsPowerOfTwo ( long value ) : bool |
Determines if the number is a power of 2.
|
|
IsPowerOfTwo ( uint value ) : bool |
Determines if the number is a power of 2.
|
|
IsPowerOfTwo ( ulong value ) : bool |
Determines if the number is a power of 2.
|
|
RoundDownToNearestPowerOfTwo ( uint value ) : uint |
Rounds a number down to the nearest power of 2. If the value is a power of two, the same value is returned. If value is zero, 1 is returned.
|
|
RoundDownToNearestPowerOfTwo ( ulong value ) : ulong |
Rounds a number down to the nearest power of 2. If the value is a power of two, the same value is returned. If value is zero, one is returned.
|
|
RoundUpToNearestPowerOfTwo ( uint value ) : uint |
Rounds a number up to the nearest power of 2. If the value is a power of two, the same value is returned. If the value is larger than the largest power of 2. It is rounded down. Method based on a method found at: http://graphics.stanford.edu/~seander/bithacks.htm Subtitle: Round up to the next highest power of 2 |
|
RoundUpToNearestPowerOfTwo ( ulong value ) : ulong |
Rounds a number up to the nearest power of 2. If the value is a power of two, the same value is returned. If the value is larger than the largest power of 2. It is rounded down. Method based on a method found at: http://graphics.stanford.edu/~seander/bithacks.htm Subtitle: Round up to the next highest power of 2 |
public static CountBitsCleared ( uint value ) : int | ||
value | uint | |
return | int |
public static CountBitsCleared ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CountBitsSet ( uint value ) : int | ||
value | uint | |
return | int |
public static CountBitsSet ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CountLeadingOnes ( uint value ) : int | ||
value | uint | |
return | int |
public static CountLeadingOnes ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CountLeadingZeros ( uint value ) : int | ||
value | uint | |
return | int |
public static CountLeadingZeros ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CountTrailingOnes ( uint value ) : int | ||
value | uint | |
return | int |
public static CountTrailingOnes ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CountTrailingZeros ( uint value ) : int | ||
value | uint | |
return | int |
public static CountTrailingZeros ( ulong value ) : int | ||
value | ulong | |
return | int |
public static CreateBitMask ( int bitCount ) : ulong | ||
bitCount | int | |
return | ulong |
public static GetClearedBitPositions ( uint value ) : IEnumerable |
||
value | uint | |
return | IEnumerable |
public static GetClearedBitPositions ( ulong value ) : IEnumerable |
||
value | ulong | |
return | IEnumerable |
public static GetSetBitPositions ( uint value ) : IEnumerable |
||
value | uint | |
return | IEnumerable |
public static GetSetBitPositions ( ulong value ) : IEnumerable |
||
value | ulong | |
return | IEnumerable |
public static IsPowerOfTwo ( int value ) : bool | ||
value | int | The value to check power of two properties |
return | bool |
public static IsPowerOfTwo ( long value ) : bool | ||
value | long | The value to check power of two properties |
return | bool |
public static IsPowerOfTwo ( uint value ) : bool | ||
value | uint | The value to check power of two properties |
return | bool |
public static IsPowerOfTwo ( ulong value ) : bool | ||
value | ulong | The value to check power of two properties |
return | bool |
public static RoundDownToNearestPowerOfTwo ( uint value ) : uint | ||
value | uint | |
return | uint |
public static RoundDownToNearestPowerOfTwo ( ulong value ) : ulong | ||
value | ulong | |
return | ulong |
public static RoundUpToNearestPowerOfTwo ( uint value ) : uint | ||
value | uint | |
return | uint |
public static RoundUpToNearestPowerOfTwo ( ulong value ) : ulong | ||
value | ulong | |
return | ulong |