haskus-binary-0.6.0.0: Haskus binary format manipulation

Safe HaskellNone
LanguageHaskell2010

Haskus.Format.Binary.Bits.Reverse

Contents

Description

Reverse bits

There are several algorithms performing the same thing here (reversing bits into words of different sizes). There are benchmarks for them in Haskus's "bench" directory. The fastest one for the current architecture should be selected below. If you find that another algorithm is faster on your architecture, please report it.

Synopsis

Generic

class BitReversable w where Source #

Data whose bits can be reversed

Minimal complete definition

reverseBits

Methods

reverseBits :: w -> w Source #

reverseBitsGeneric :: (FiniteBits a, Integral a) => a -> a Source #

Reverse bits in a Word

Algorithms

reverseBitsObvious :: FiniteBits a => a -> a Source #

Obvious recursive verion

reverseBits3Ops :: Word8 -> Word8 Source #

Reverse bits in a Word8 (3 64-bit operations, modulus division)

reverseBits4Ops :: Word8 -> Word8 Source #

Reverse bits in a Word8 (4 64-bit operations, no division)

reverseBitsTable :: Word8 -> Word8 Source #

Reverse bits using a lookup table

reverseBits7Ops :: Word8 -> Word8 Source #

Reverse bits in a Word8 (7 no 64-bit operations, no division)

reverseBits5LgN :: FiniteBits a => a -> a Source #

Parallel recursive version

liftReverseBits :: (FiniteBits a, Integral a) => (Word8 -> Word8) -> a -> a Source #

Convert a function working on Word8 to one working on any Word

The number of bits in the Word must be a multiple of 8