bits-0.2.1: Various bit twiddling and bitwise serialization primitives

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Data.Bits.Extras

Description

Calculate a number of fiddly bit operations using fast de Bruijn multiplication tables.

Documentation

class (Num t, Bits t) => Ranked t whereSource

Methods

lsb :: t -> IntSource

Calculate the least significant set bit using a debruijn multiplication table. NB: The result of this function is undefined when given 0.

rank :: t -> IntSource

Calculate the number of trailing 0 bits.

nlz :: t -> IntSource

Calculate the number of leading zeros.

w8 :: Integral a => a -> Word8Source