haskus-binary-1.5: Haskus binary format manipulation

Safe HaskellNone
LanguageHaskell2010

Haskus.Binary.Bits.Mask

Synopsis

Documentation

class MaskBits a where Source #

Methods

makeMaskDyn :: Word -> a Source #

Make a mask dynamically

Instances
MaskBits Int Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

Methods

makeMaskDyn :: Word -> Int Source #

MaskBits Int8 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Int16 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Int32 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Int64 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Natural Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Word Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Word8 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Word16 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Word32 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

MaskBits Word64 Source # 
Instance details

Defined in Haskus.Binary.Bits.Mask

makeMaskFinite :: forall a. (ShiftableBits a, FiniteBits a, KnownNat (BitSize a), Bitwise a) => Word -> a Source #

makeMaskFinite 3 = 00000111

makeMask :: forall n a. (KnownNat n, MaskBits a) => a Source #

Make a mask statically

maskDyn :: (MaskBits a, Bitwise a) => Word -> a -> a Source #

Keep only the n least-significant bits of the given value

type Maskable n a = (MaskBits a, Bitwise a, KnownNat n) Source #

mask :: forall n a. Maskable n a => a -> a Source #

Keep only the n least-significant bits of the given value