A bit manipulation readability enhancement library.
Provides bit counting and other niche bit manipulation facilities for System.SByte values.
public static class SByteAlgorithmsExtensions
Inheritance System.Object đŸ¡’ SByteAlgorithmsExtensions
Methods | Â |
---|---|
AreOnlyFirstAndLastBitsSet(this sbyte) | Determines if only the lowest bit and one other higher bit are set. |
CountBitsSet(this sbyte) | Counts the bits that are set to 1 in a number. |
CountLeadingZeros(this sbyte) | Computes the number of sequentially zeroed bits occupying the most significant bit positions. |
CountTrailingZeros(this sbyte) | Computes the number of sequentially zeroed bits occupying the least significant bit positions. |
GetHighestBitSet(this sbyte) | Calculate the index of the highest bit that’s been set. |
GetLowestBitSet(this sbyte) | Calculate the index of the lowest bit that’s been set. |
GetSign(this sbyte) | Returns a value indicating the sign of the number. |
IsEven(this sbyte) | Determines if the number is odd. |
IsNegative(this sbyte) | Indicates if the number is negative. |
IsOdd(this sbyte) | Determines if the number is odd. |
IsPositive(this sbyte) | Indicates if the number is zero or positive. |
IsPowerOfTwo(this sbyte) | Determines if the number is a power of two. |
PopCount(this sbyte) | Counts the bits that are set to 1 in a number. |
RotateLeft(this sbyte, int) | Performs a bitwise left rotation on a number. |
RotateRight(this sbyte, int) | Performs a bitwise right rotation on a number. |
RoundUpToPowerOfTwo(this sbyte) | For any given number return the number if it’s a power of two, or return the next higher power of two capable of fitting in the data type. For negative values or values that would result in a negative next higher power of two, zero is returned. (e.g. number > 2^(k-2)) where k is the bit size.) |