Extended bit operations, implemented using GCC builtins (see http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Other-Builtins.html).

- class Bits x => ExtraBits x where
- lowestBitPlus1 :: x -> Word32
- leadingZeros :: x -> Word32
- trailingZeros :: x -> Word32
- populationCount :: x -> Word32
- parity :: x -> Word32
- byteSwap :: x -> x

# Documentation

class Bits x => ExtraBits x whereSource

lowestBitPlus1 :: x -> Word32Source

Returns one plus the index of the least significant 1-bit of x, or if x is zero, returns zero.

leadingZeros :: x -> Word32Source

Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined.

trailingZeros :: x -> Word32Source

Returns the number of trailing 0-bits in x, starting at the least significant bit position. If x is 0, the result is undefined.

populationCount :: x -> Word32Source

Returns the number of 1-bits in x.

Returns the parity of x, i.e. the number of 1-bits in x modulo 2.

Returns x with the order of the bytes reversed; for example, 0xaabbccdd becomes 0xddccbbaa. Byte here always means exactly 8 bits.