Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- topNBits :: Int -> Word8
- bottomNBits :: Int -> Word8
- leftShift :: Int -> ByteString -> ByteString
- rightShift :: Int -> ByteString -> ByteString
- leftTruncateBits :: Int -> ByteString -> ByteString
- rightTruncateBits :: Int -> ByteString -> ByteString
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