binary-strict-0.4.8.6: Binary deserialisation using strict ByteStrings

Safe HaskellSafe
LanguageHaskell2010

Data.Binary.Strict.BitUtil

Synopsis

Documentation

topNBits :: Int -> Word8 Source #

This is used for masking the last byte of a ByteString so that extra bits don't leak in

bottomNBits :: Int -> Word8 Source #

Return a Word8 with the bottom n bits set

leftShift :: Int -> ByteString -> ByteString Source #

Shift the whole ByteString some number of bits left where 0 <= n < 8

rightShift :: Int -> ByteString -> ByteString Source #

Shift the whole ByteString some number of bits right where 0 <= n < 8

leftTruncateBits :: Int -> ByteString -> ByteString Source #

Truncate a ByteString to a given number of bits (counting from the left) by masking out extra bits in the last byte

rightTruncateBits :: Int -> ByteString -> ByteString Source #

Truncate a ByteString to a given number of bits (counting from the right) by masking out extra bits in the first byte