BinaryMath provides static methods for "Bit" mathematics.
Constructor | Description |
Full Usage:
BinaryMath()
|
|
Static member | Description |
Full Usage:
BinaryMath.IsNonzeroPowerOfTwo(x)
Parameters:
int
-
The argument to test.
Returns: bool
True if x > 0 and x is a power of two.
|
Return true if x > 0 and x is a power of two.
|
Full Usage:
BinaryMath.IsNonzeroPowerOfTwo(x)
Parameters:
uint32
-
The argument to test.
Returns: bool
True if x > 0 and x is a power of two.
|
Return true if x > 0 and x is a power of two.
|
Full Usage:
BinaryMath.IsNonzeroPowerOfTwo(x)
Parameters:
int64
-
The argument to test.
Returns: bool
True if x > 0 and x is a power of two.
|
Return true if x > 0 and x is a power of two.
|
Full Usage:
BinaryMath.IsNonzeroPowerOfTwo(x)
Parameters:
uint64
-
The argument to test.
Returns: bool
True if x > 0 and x is a power of two.
|
Return true if x > 0 and x is a power of two.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
byte
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
sbyte
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
uint16
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
int16
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
uint32
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
int
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
uint64
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsParityOdd(x)
Parameters:
int64
-
The argument.
Returns: bool
True, if an odd number of bits is set to 1, or false, if an even number of bits is set to 1.
|
Determines, if x contains an odd number of '1' bits.
|
Full Usage:
BinaryMath.IsPowerOfTwoOrZero(x)
Parameters:
int
-
Argument to test.
Returns: bool
Returns true if the number is a power of two or is equal to zero.
|
Returns true if number is a power of two or is zero.
|
Full Usage:
BinaryMath.IsPowerOfTwoOrZero(x)
Parameters:
uint32
-
Argument to test.
Returns: bool
Returns true if the number is a power of two or is equal to zero.
|
Returns true if number is a power of two or is zero.
|
Full Usage:
BinaryMath.IsPowerOfTwoOrZero(x)
Parameters:
int64
-
Argument to test.
Returns: bool
Return true if number is 0 (!) or a power of two.
|
Return true if number is 0 (!) or a power of two
|
Full Usage:
BinaryMath.IsPowerOfTwoOrZero(x)
Parameters:
uint64
-
Argument to test.
Returns: bool
Returns true if the number is a power of two or is equal to zero.
|
Returns true if number is a power of two or is zero.
|
Full Usage:
BinaryMath.Ld(x)
Parameters:
int
-
The argument.
Returns: int
A number k so that 2^k <= x < 2^(k+1). If x<0 then Int32.MinValue is returned.
|
Returns k so that 2^k <= x < 2^(k+1). If x==0 then 0 is returned.
|
Full Usage:
BinaryMath.Ld(x)
Parameters:
uint32
-
The argument.
Returns: int
A number k so that 2^k <= x < 2^(k+1). If x==0 then Int32.MinValue is returned.
|
Returns k so that 2^k <= x < 2^(k+1). If x==0 then 0 is returned.
|
Full Usage:
BinaryMath.Ld(x)
Parameters:
int64
-
The argument.
Returns: int
A number k so that 2^k <= x < 2^(k+1). If x<0 then Int32.MinValue is returned.
|
Returns k so that 2^k <= x < 2^(k+1). If x==0 then 0 is returned.
|
Full Usage:
BinaryMath.Ld(x)
Parameters:
uint64
-
The argument.
Returns: int
A number k so that 2^k <= x < 2^(k+1). If x==0 then Int32.MinValue is returned.
|
Returns k so that 2^k <= x < 2^(k+1). If x==0 then 0 is returned.
|
Full Usage:
BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)
Parameters:
int
-
The argument to test.
Returns: int
The argument, if it is a power of two. Else the next greater number which is a power of two.
|
Return x if x is is a power of two, else return the smallest number >x, which is a power of two.
|
Full Usage:
BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)
Parameters:
uint32
-
The argument to test.
Returns: uint32
The argument, if it is a power of two. Else the next greater number which is a power of two.
|
Return x if x is is a power of two, else return the smallest number >x, which is a power of two.
|
Full Usage:
BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)
Parameters:
int64
-
The argument to test.
Returns: int64
The argument, if it is a power of two. Else the next greater number which is a power of two.
|
Return x if x is is a power of two, else return the smallest number >x, which is a power of two.
|
Full Usage:
BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)
Parameters:
uint64
-
The argument to test.
Returns: uint64
The argument, if it is a power of two. Else the next greater number which is a power of two.
|
Return x if x is is a power of two, else return the smallest number >x, which is a power of two.
|