Helper class for working with bits

Static methods

staticinlineflipDWORD (x:Int):Int

Flips the bytes within the DWORD x (4 bytes) to convert between little endian and big endian format.

staticinlineflipWORD (x:Int):Int

Flips the bytes within the WORD x (2 bytes) to convert between little endian and big endian format.

staticinlinemask (n:Int):Int

Constructs a mask of n bits.

staticmsb (x:Int):Int

Returns the most significant bit of x.

staticnlz (x:Int):Int

Counts the number of leading 0's in x. For example 0b10000 has 27 leading 0's.

staticntz (x:Int):Int

Counts the number of trailing 0's in x. For example 0b10000 has 4 trailing 0's.

staticones (x:Int):Int

Counts the number of "1"-bits in x. For example 0b00110111 has 5 bits set.

staticreverse (x:Int):Int

Reverses x; For example 0b111000 becomes 0b000111.

staticinlinerol (x:Int, n:Int):Int

Bitwise rotates the integer x by n places to the left.

staticinlineror (x:Int, n:Int):Int

Bitwise rotates the integer x by n places to the right.

staticinlineswap (x:Int, i:Int, j:Int):Int

Swaps the bit at index i with the bit at index j in the bit field x (LSB=0).