License | BSD-style |
---|---|
Maintainer | Haskell Foundation |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Basement.Bits
Description
Documentation
operation over bits
Methods
(.&.) :: bits -> bits -> bits infixl 7 #
(.|.) :: bits -> bits -> bits infixl 5 #
(.^.) :: bits -> bits -> bits infixl 6 #
(.<<.) :: bits -> CountOf Bool -> bits infixl 8 #
(.>>.) :: bits -> CountOf Bool -> bits infixl 8 #
construct a bit set with the bit at the given index set.
bit :: Integral bits => Offset Bool -> bits #
construct a bit set with the bit at the given index set.
isBitSet :: bits -> Offset Bool -> Bool #
test the bit at the given index is set
isBitSet :: (Integral bits, Eq bits) => bits -> Offset Bool -> Bool #
test the bit at the given index is set
setBit :: bits -> Offset Bool -> bits #
set the bit at the given index
setBit :: Integral bits => bits -> Offset Bool -> bits #
set the bit at the given index
clearBit :: bits -> Offset Bool -> bits #
clear the bit at the given index
clearBit :: FiniteBitsOps bits => bits -> Offset Bool -> bits #
clear the bit at the given index
class FiniteBitsOps bits where #
operation over finite bits
Minimal complete definition
Methods
numberOfBits :: bits -> CountOf Bool #
get the number of bits in the given object
rotateL :: bits -> CountOf Bool -> bits infixl 8 #
rotate the given bit set.
rotateR :: bits -> CountOf Bool -> bits infixl 8 #
rotate the given bit set.
popCount :: bits -> CountOf Bool #
count of number of bit set to 1 in the given bit set.
reverse all bits in the argument
countLeadingZeros :: bits -> CountOf Bool #
count of the number of leading zeros
countLeadingZeros :: BitOps bits => bits -> CountOf Bool #
count of the number of leading zeros
countTrailingZeros :: bits -> CountOf Bool #
count of the number of trailing zeros
countTrailingZeros :: BitOps bits => bits -> CountOf Bool #
count of the number of trailing zeros
Instances
Bool set of n
bits.
Instances
SizeValid n => Bounded (Bits n) # | |
SizeValid n => Enum (Bits n) # | |
Eq (Bits n) # | |
Ord (Bits n) # | |
Show (Bits n) # | |
SizeValid n => Additive (Bits n) # | |
SizeValid n => IDivisible (Bits n) # | |
SizeValid n => Multiplicative (Bits n) # | |
SizeValid n => Subtractive (Bits n) # | |
SizeValid n => BitOps (Bits n) # | |
(SizeValid n, NatWithinBound (CountOf Bool) n) => FiniteBitsOps (Bits n) # | |
type Difference (Bits n) # | |