-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bit-vector arithmetic library -- -- Bit-vectors implemented as a wrapper over integers. @package bv @version 0.2.2 -- | Implementation of bit-vectors as wrappers over Integer. -- --
-- >>> bitVec 4 3 -- [4]3 ---- -- This function also handles negative values. -- --
-- >>> bitVec 4 (-1) -- [4]15 --bitVec :: Integral a => Int -> a -> BV -- | Create a mask of ones. ones :: Int -> BV -- | Create a mask of zeros. zeros :: Int -> BV -- | Test if the signed value of a bit-vector is a natural number. isNat :: BV -> Bool -- | Test if the signed value of a bit-vector is a positive number. isPos :: BV -> Bool -- | Fixed-size equality. -- -- In contrast with ==, which is size-polymorphic, this -- equality requires both bit-vectors to be of equal size. -- --
-- >>> [n]k ==. [m]k -- False ---- --
-- >>> [n]k ==. [n]k -- True --(==.) :: BV -> BV -> Bool -- | Fixed-size inequality. -- -- The negated version of ==.. (/=.) :: BV -> BV -> Bool -- | Fixed-size less-than. (<.) :: BV -> BV -> Bool -- | Fixed-size less-than-or-equals. (<=.) :: BV -> BV -> Bool -- | Fixed-size greater-than. (>.) :: BV -> BV -> Bool -- | Fixed-size greater-than-or-equals. (>=.) :: BV -> BV -> Bool -- | Fixed-size signed less-than. slt :: BV -> BV -> Bool -- | Fixed-size signed less-than-or-equals. sle :: BV -> BV -> Bool -- | Fixed-size signed greater-than. sgt :: BV -> BV -> Bool -- | Fixed-size signed greater-than-or-equals. sge :: BV -> BV -> Bool -- | Bit indexing. -- -- u @. i stands for the i-th bit of u. -- --
-- >>> [4]2 @. 0 -- False ---- --
-- >>> [4]2 @. 1 -- True --(@.) :: Integral ix => BV -> ix -> Bool -- |
-- index i a == a @. i --index :: Integral ix => ix -> BV -> Bool -- | Bit-string extraction. -- --
-- u @@ (j,i) == fromBits (map (u @.) [j,j-1..i]) ---- --
-- >>> [4]7 @@ (3,1) -- [3]3 --(@@) :: Integral ix => BV -> (ix, ix) -> BV -- |
-- extract j i a == a @@ (j,i) --extract :: Integral ix => ix -> ix -> BV -> BV -- | Reverse bit-indexing. -- -- Index starting from the most significant bit. -- --
-- u !. i == u @. (size u - i - 1) ---- --
-- >>> [3]3 !. 0 -- False --(!.) :: Integral ix => BV -> ix -> Bool -- | Take least significant bits. -- --
-- least m u == u @@ (m-1,0) --least :: Integral ix => ix -> BV -> BV -- | Take most significant bits. -- --
-- most m u == u @@ (n-1,n-m) --most :: Integral ix => ix -> BV -> BV -- | Most significant bit. -- --
-- msb u == u !. 0 --msb :: BV -> Bool -- | Least significant bit. -- --
-- lsb u == u @. 0 --lsb :: BV -> Bool -- | Most significant 1-bit. -- -- Pre: input must be non-zero. -- --
-- >>> msb1 [4]2 -- 1 ---- --
-- >>> msb1 [4]4 -- 2 --msb1 :: BV -> Int -- | Bit-vector signum as an Integral. signumI :: Integral a => BV -> a -- | 2's complement signed division. sdiv :: BV -> BV -> BV -- | 2's complement signed remainder (sign follows dividend). srem :: BV -> BV -> BV -- | 2's complement signed remainder (sign follows divisor). smod :: BV -> BV -> BV -- | Ceiling logarithm base 2. -- -- Pre: input bit-vector must be non-zero. lg2 :: BV -> BV -- | Concatenation of two bit-vectors. (#) :: BV -> BV -> BV -- | Concatenation of two bit-vectors. cat :: BV -> BV -> BV -- | Logical extension. -- --
-- >>> zeroExtend 3 [1]1 -- [4]1 --zeroExtend :: Integral size => size -> BV -> BV -- | Arithmetic extension. -- --
-- >>> signExtend 2 [2]1 -- [4]1 ---- --
-- >>> signExtend 2 [2]3 -- [4]15 --signExtend :: Integral size => size -> BV -> BV -- |
-- foldl_ f z (fromBits [un, ..., u1, u0]) == ((((z `f` un) `f` ...) `f` u1) `f` u0) ---- --
-- foldl_ f e = fromBits . foldl f e . toBits --foldl_ :: (a -> Bool -> a) -> a -> BV -> a -- |
-- foldr_ f z (fromBits [un, ..., u1, u0]) == un `f` (... `f` (u1 `f` (u0 `f` z))) ---- --
-- foldr_ f e = fromBits . foldr f e . toBits --foldr_ :: (Bool -> a -> a) -> a -> BV -> a -- |
-- reverse_ == fromBits . reverse . toBits --reverse_ :: BV -> BV -- | Pre: if replicate_ n u then n > 0 must -- hold. -- --
-- replicate_ n == fromBits . concat . replicate n . toBits --replicate_ :: Integral size => size -> BV -> BV -- | Conjunction. -- --
-- and_ == foldr1 (.&.) --and_ :: [BV] -> BV -- | Disjunction. -- --
-- or_ == foldr1 (.|.) --or_ :: [BV] -> BV -- | Split a bit-vector k times. -- --
-- >>> split 3 [4]15 -- [[2]0,[2]3,[2]3] --split :: Integral times => times -> BV -> [BV] -- | Split a bit-vector into n-wide pieces. -- --
-- >>> group_ 3 [4]15 -- [[3]1,[3]7] --group_ :: Integral size => size -> BV -> [BV] -- | Concatenate a list of bit-vectors. -- --
-- >>> join [[2]3,[2]2] -- [4]14 --join :: [BV] -> BV -- | An alias for complement. not_ :: BV -> BV -- | Negated .&.. nand :: BV -> BV -> BV -- | Negated .|.. nor :: BV -> BV -> BV -- | Negated xor. xnor :: BV -> BV -> BV -- | Left shift. (<<.) :: BV -> BV -> BV -- | Left shift. shl :: BV -> BV -> BV -- | Logical right shift. (>>.) :: BV -> BV -> BV -- | Logical right shift. shr :: BV -> BV -> BV -- | Arithmetic right shift ashr :: BV -> BV -> BV -- | Rotate left. (<<<.) :: BV -> BV -> BV -- | Rotate left. rol :: BV -> BV -> BV -- | Rotate right. (>>>.) :: BV -> BV -> BV -- | Rotate right. ror :: BV -> BV -> BV -- | Create a bit-vector from a single bit. fromBool :: Bool -> BV -- | Create a bit-vector from a big-endian list of bits. -- --
-- >>> fromBits [False, False, True] -- [3]1 --fromBits :: [Bool] -> BV -- | Create a big-endian list of bits from a bit-vector. -- --
-- >>> toBits [4]11 -- [True, False, True, True] --toBits :: BV -> [Bool] -- | Show a bit-vector in binary form. showBin :: BV -> String -- | Show a bit-vector in octal form. showOct :: BV -> String -- | Show a bit-vector in hexadecimal form. showHex :: BV -> String -- | Greatest natural number representable with n bits. maxNat :: (Integral a, Integral b) => a -> b -- | Minimum width of a bit-vector to represent a given integer number. -- --
-- >>> integerWith 4 -- 3 ---- --
-- >>> integerWith (-4) -- 4 --integerWidth :: Integer -> Int instance Bits BV instance Integral BV instance Enum BV instance Real BV instance Num BV instance Ord BV instance Eq BV instance Data BV instance Typeable BV instance Show BV