class (FiniteBits w, FiniteBits (UnsignedWord w), FiniteBits (SignedWord w)) => BinaryWord w whereTwo's complement, fixed length binary words.
Associated types
type family UnsignedWord wThe unsigned variant type
type family SignedWord wThe signed variant type
Methods
unsignedWord :: w -> UnsignedWord wConvert the word to the unsigned type (identical to fromIntegral)
signedWord :: w -> SignedWord wConvert the word to the signed type (identical to fromIntegral)
unwrappedAdd :: w -> w -> (w, UnsignedWord w)Unwrapped addition
unwrappedMul :: w -> w -> (w, UnsignedWord w)Unwrapped multiplication
leadingZeroes :: w -> IntNumber of leading (from MSB) zero bits
trailingZeroes :: w -> IntNumber or trailing (from LSB) zero bits
allZeroes :: wThe word with all bits set to 0
allOnes :: wThe word with all bits set to 1
msb :: wThe word with MSB set to 1 and all the other bits set to 0
lsb :: wThe word with LSB set to 1 and all the other bits set to 0
testMsb :: w -> BoolTest if the MSB is 1
testLsb :: w -> BoolTest if the LSB is 1
setMsb :: w -> wSet the MSB to 1
setLsb :: w -> wSet the LSB to 1
clearMsb :: w -> wSet the MSB to 0
clearLsb :: w -> wSet the LSB to 0
Instances8BinaryWord, …
BinaryWord Int16Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Int32Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Int64Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Int8Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Word16Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Word32Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Word64Defined in data-bword-0.1.0.2 · Data.BinaryWordBinaryWord Word8Defined in data-bword-0.1.0.2 · Data.BinaryWord