License | BSD-style |
---|---|
Maintainer | Haskell Foundation |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class BitOps bits where
- (.&.) :: bits -> bits -> bits
- (.|.) :: bits -> bits -> bits
- (.^.) :: bits -> bits -> bits
- (.<<.) :: bits -> CountOf Bool -> bits
- (.>>.) :: bits -> CountOf Bool -> bits
- bit :: Offset Bool -> bits
- isBitSet :: bits -> Offset Bool -> Bool
- setBit :: bits -> Offset Bool -> bits
- clearBit :: bits -> Offset Bool -> bits
- class FiniteBitsOps bits where
- data Bits (n :: Nat)
- toBits :: SizeValid n => Natural -> Bits n
- allOne :: forall n. SizeValid n => Bits n
Documentation
operation over bits
(.&.) :: 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.
isBitSet :: 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
clearBit :: bits -> Offset Bool -> bits #
clear the bit at the given index
default clearBit :: FiniteBitsOps bits => bits -> Offset Bool -> bits #
Instances
class FiniteBitsOps bits where #
operation over finite bits
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
default countLeadingZeros :: BitOps bits => bits -> CountOf Bool #
countTrailingZeros :: bits -> CountOf Bool #
count of the number of trailing zeros
default countTrailingZeros :: BitOps bits => bits -> CountOf Bool #
Instances
FiniteBitsOps Bool # | |
FiniteBitsOps Int8 # | |
FiniteBitsOps Int16 # | |
Defined in Basement.Bits | |
FiniteBitsOps Int32 # | |
Defined in Basement.Bits | |
FiniteBitsOps Int64 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word # | |
FiniteBitsOps Word8 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word16 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word32 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word64 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word128 # | |
Defined in Basement.Bits | |
FiniteBitsOps Word256 # | |
Defined in Basement.Bits | |
(SizeValid n, NatWithinBound (CountOf Bool) n) => FiniteBitsOps (Bits n) # | |
Defined in Basement.Bits |
Bool set of n
bits.
Instances
SizeValid n => Bounded (Bits n) # | |
SizeValid n => Enum (Bits n) # | |
Defined in Basement.Bits | |
Eq (Bits n) # | |
Ord (Bits n) # | |
Show (Bits n) # | |
SizeValid n => Subtractive (Bits n) # | |
Defined in Basement.Bits type Difference (Bits n) # | |
SizeValid n => Additive (Bits n) # | |
SizeValid n => IDivisible (Bits n) # | |
SizeValid n => Multiplicative (Bits n) # | |
SizeValid n => BitOps (Bits n) # | |
Defined in Basement.Bits (.&.) :: Bits n -> Bits n -> Bits n # (.|.) :: Bits n -> Bits n -> Bits n # (.^.) :: Bits n -> Bits n -> Bits n # (.<<.) :: Bits n -> CountOf Bool -> Bits n # (.>>.) :: Bits n -> CountOf Bool -> Bits n # bit :: Offset Bool -> Bits n # isBitSet :: Bits n -> Offset Bool -> Bool # | |
(SizeValid n, NatWithinBound (CountOf Bool) n) => FiniteBitsOps (Bits n) # | |
Defined in Basement.Bits | |
type Difference (Bits n) # | |
Defined in Basement.Bits |