| Copyright | (c) Claude Heiland-Allen 2012 |
|---|---|
| License | BSD3 |
| Maintainer | [email protected] |
| Stability | unstable |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell98 |
Data.Bits.Bitwise
Contents
Description
- repeat :: (Num b, Bits b) => Bool -> b
- map :: (Num b, Bits b) => (Bool -> Bool) -> b -> b
- zipWith :: (Num b, Bits b) => (Bool -> Bool -> Bool) -> b -> b -> b
- or :: (Num b, Bits b) => b -> Bool
- and :: (Num b, Bits b) => b -> Bool
- any :: (Num b, Bits b) => (Bool -> Bool) -> b -> Bool
- all :: (Num b, Bits b) => (Bool -> Bool) -> b -> Bool
- isUniform :: (Num b, Bits b) => b -> Maybe Bool
- mask :: (Num b, Bits b) => Int -> b
- splitAt :: (Num b, Bits b) => Int -> b -> (b, b)
- joinAt :: (Num b, Bits b) => Int -> b -> b -> b
- fromBool :: (Num b, Bits b) => Bool -> b
- fromListLE :: (Num b, Bits b) => [Bool] -> b
- toListLE :: (Num b, Bits b) => b -> [Bool]
- fromListBE :: (Num b, Bits b) => [Bool] -> b
- toListBE :: (Num b, Bits b) => b -> [Bool]
- packWord8LE :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Word8
- unpackWord8LE :: Word8 -> (Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool)
- packWord8BE :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Word8
- unpackWord8BE :: Word8 -> (Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool)
Boolean operations lifted to bitwise operations.
Lift a unary boolean operation to a bitwise operation.
The implementation is by exhaustive input/output case analysis: thus the operation provided must be total.
Lift a binary boolean operation to a bitwise operation.
The implementation is by exhaustive input/output case analysis: thus the operation provided must be total.
True when the predicate is true for any bit.
True when the predicate is true for all bits.
isUniform :: (Num b, Bits b) => b -> Maybe Bool Source
Determine if a Bits is all 1s, all 0s, or neither.
Splitting/joining Bits to/from (lsb, msb).
A mask with count least significant bits set.
Split a word into (lsb, msb). Ensures lsb has no set bits above the split point.
Arguments
| :: (Num b, Bits b) | |
| => Int | join point |
| -> b | least significant bits |
| -> b | most significant bits |
| -> b | word |
Join lsb with msb to make a word. Assumes lsb has no set bits above the join point.
(Un)packing Bits to/from lists of Bool.
Convert a little-endian list of bits to Bits.
Convert a big-endian list of bits to Bits.
(Un)packing Word8 to/from 8-tuples of Bool.
Arguments
| :: Bool | least significant bit |
| -> Bool | |
| -> Bool | |
| -> Bool | |
| -> Bool | |
| -> Bool | |
| -> Bool | |
| -> Bool | most significant bit |
| -> Word8 |
Pack bits into a byte in little-endian order.
Arguments
| :: Word8 | |
| -> (Bool, Bool, Bool, Bool, Bool, Bool, Bool, Bool) | (least significant bit, ..., most significant bit) |
Extract the bits from a byte in little-endian order.