Skip to content

Latest commit

 

History

History
47 lines (38 loc) · 858 Bytes

bitvector.md

File metadata and controls

47 lines (38 loc) · 858 Bytes

Data.BitVector

Data.BitVector @hackage

Constructor

bitVec :: Integral a => Int -> a -> BV
>>> bitVec 3 4 -- [3]4

ones :: Int -> BV
>>> ones 3 -- [3]7

zeros :: Int -> BV
>>> zeros 3 -- [3]0

Selector

###single bit index

(@.) :: Integral ix => BV -> ix -> Bool
index :: Integral ix => ix -> BV -> Bool

###bits field extraction

(@@) :: Integral ix => BV -> (ix, ix) -> BV
extract :: Integral ix => ix -> ix -> BV -> BV

Arithmetic

concatenation

(#) :: BV -> BV -> BV
cat :: BV -> BV -> BV

extending

zeroExtend :: Integral size => size -> BV -> BV
signExtend :: Integral size => size -> BV -> BV

list-like operation

foldl, foldr, reverse, replicate, and, or, split, group, join

bit wise operation