haskus-binary-1.5: Haskus binary format manipulation

Safe HaskellNone
LanguageHaskell2010

Haskus.Binary.Bits.Index

Description

Bit indexable types

Synopsis

Documentation

class IndexableBits a where Source #

Type whose bits are indexable

Minimal complete definition

Nothing

Methods

bit :: Word -> a Source #

bit i is a value with the ith bit set and all other bits clear.

bit :: (Num a, ShiftableBits a) => Word -> a Source #

bit i is a value with the ith bit set and all other bits clear.

setBit :: a -> Word -> a Source #

x `setBit` i is the same as x .|. bit i

setBit :: Bitwise a => a -> Word -> a Source #

x `setBit` i is the same as x .|. bit i

clearBit :: a -> Word -> a Source #

x `clearBit` i is the same as x .&. complement (bit i)

clearBit :: (FiniteBits a, Bitwise a) => a -> Word -> a Source #

x `clearBit` i is the same as x .&. complement (bit i)

complementBit :: a -> Word -> a Source #

x `complementBit` i is the same as x `xor` bit i

complementBit :: Bitwise a => a -> Word -> a Source #

x `complementBit` i is the same as x `xor` bit i

testBit :: a -> Word -> Bool Source #

Return True if the nth bit of the argument is 1

testBit :: (Bitwise a, Num a, Eq a) => a -> Word -> Bool Source #

Return True if the nth bit of the argument is 1

popCount :: a -> Word Source #

Return the number of set bits

popCount :: (Bitwise a, Num a, Eq a) => a -> Word Source #

Return the number of set bits

Instances
IndexableBits Int Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Int8 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Int16 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Int32 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Int64 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Integer Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Natural Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Word Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Word8 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Word16 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Word32 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Word64 Source # 
Instance details

Defined in Haskus.Binary.Bits.Index

IndexableBits Buffer Source # 
Instance details

Defined in Haskus.Binary.Buffer

IndexableBits a => IndexableBits (AsLittleEndian a) Source # 
Instance details

Defined in Haskus.Binary.Endianness

IndexableBits a => IndexableBits (AsBigEndian a) Source # 
Instance details

Defined in Haskus.Binary.Endianness

(Storable a, IndexableBits a, FiniteBits a, KnownNat (BitSize a), KnownNat n, Bitwise a) => IndexableBits (Vector n a) Source # 
Instance details

Defined in Haskus.Binary.Vector

Methods

bit :: Word -> Vector n a Source #

setBit :: Vector n a -> Word -> Vector n a Source #

clearBit :: Vector n a -> Word -> Vector n a Source #

complementBit :: Vector n a -> Word -> Vector n a Source #

testBit :: Vector n a -> Word -> Bool Source #

popCount :: Vector n a -> Word Source #