BinaryMath Type

BinaryMath provides static methods for "Bit" mathematics.

Constructors

Constructor Description

BinaryMath()

Full Usage: BinaryMath()

Static members

Static member Description

BinaryMath.IsNonzeroPowerOfTwo(x)

Full Usage: BinaryMath.IsNonzeroPowerOfTwo(x)

Parameters:
    x : 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.

x : int

The argument to test.

Returns: bool

True if x > 0 and x is a power of two.

BinaryMath.IsNonzeroPowerOfTwo(x)

Full Usage: BinaryMath.IsNonzeroPowerOfTwo(x)

Parameters:
    x : 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.

x : uint32

The argument to test.

Returns: bool

True if x > 0 and x is a power of two.

BinaryMath.IsNonzeroPowerOfTwo(x)

Full Usage: BinaryMath.IsNonzeroPowerOfTwo(x)

Parameters:
    x : 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.

x : int64

The argument to test.

Returns: bool

True if x > 0 and x is a power of two.

BinaryMath.IsNonzeroPowerOfTwo(x)

Full Usage: BinaryMath.IsNonzeroPowerOfTwo(x)

Parameters:
    x : 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.

x : uint64

The argument to test.

Returns: bool

True if x > 0 and x is a power of two.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsParityOdd(x)

Full Usage: BinaryMath.IsParityOdd(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.IsPowerOfTwoOrZero(x)

Full Usage: BinaryMath.IsPowerOfTwoOrZero(x)

Parameters:
    x : 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.

x : int

Argument to test.

Returns: bool

Returns true if the number is a power of two or is equal to zero.

BinaryMath.IsPowerOfTwoOrZero(x)

Full Usage: BinaryMath.IsPowerOfTwoOrZero(x)

Parameters:
    x : 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.

x : uint32

Argument to test.

Returns: bool

Returns true if the number is a power of two or is equal to zero.

BinaryMath.IsPowerOfTwoOrZero(x)

Full Usage: BinaryMath.IsPowerOfTwoOrZero(x)

Parameters:
    x : 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

x : int64

Argument to test.

Returns: bool

Return true if number is 0 (!) or a power of two.

BinaryMath.IsPowerOfTwoOrZero(x)

Full Usage: BinaryMath.IsPowerOfTwoOrZero(x)

Parameters:
    x : 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.

x : uint64

Argument to test.

Returns: bool

Returns true if the number is a power of two or is equal to zero.

BinaryMath.Ld(x)

Full Usage: BinaryMath.Ld(x)

Parameters:
    x : 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.

x : int

The argument.

Returns: int

A number k so that 2^k <= x < 2^(k+1). If x<0 then Int32.MinValue is returned.

BinaryMath.Ld(x)

Full Usage: BinaryMath.Ld(x)

Parameters:
    x : 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.

x : uint32

The argument.

Returns: int

A number k so that 2^k <= x < 2^(k+1). If x==0 then Int32.MinValue is returned.

BinaryMath.Ld(x)

Full Usage: BinaryMath.Ld(x)

Parameters:
    x : 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.

x : int64

The argument.

Returns: int

A number k so that 2^k <= x < 2^(k+1). If x<0 then Int32.MinValue is returned.

BinaryMath.Ld(x)

Full Usage: BinaryMath.Ld(x)

Parameters:
    x : 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.

x : uint64

The argument.

Returns: int

A number k so that 2^k <= x < 2^(k+1). If x==0 then Int32.MinValue is returned.

BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Full Usage: BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Full Usage: BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Full Usage: BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Parameters:
    x : 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.

x : 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.

BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Full Usage: BinaryMath.NextPowerOfTwoGreaterOrEqualThan(x)

Parameters:
    x : 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.

x : 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.