Helper class for working with bits

Static methods

staticinline flipDWORD (x:Int):Int

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

staticinline flipWORD (x:Int):Int

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

staticinline mask (n:Int):Int

Constructs a mask of n bits.

staticinline msb (x:Int):Int

Returns the most significant bit of x.

staticinline nlz (x:Int):Int

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

staticinline ntz (x:Int):Int

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

staticinline ones (x:Int):Int

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

staticinline reverse (x:Int):Int

Reverses x; For example 0b111000 becomes 0b000111.

staticinline rol (x:Int, n:Int):Int

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

staticinline ror (x:Int, n:Int):Int

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