Modulecborg-0.2.10.0Haskell2010
Codec.CBOR.Magic
An internal module for doing magical, low-level, and unholy things in the name of efficiency.
Contents
Synopsis
- value grabWord8
- value grabWord16
- value grabWord32
- value grabWord64
- value eatTailWord8
- value eatTailWord16
- value eatTailWord32
- value eatTailWord64
- value wordToFloat16
- value floatToWord16
- value wordToFloat32
- value wordToFloat64
- value word8ToWord
- value word16ToWord
- value word32ToWord
- value word64ToWord
- value word8ToInt
- value word16ToInt
- value word32ToInt
- value word64ToInt
- value intToWord
- value intToInt64
- value intToWord64
- value int64ToWord64
- value nintegerFromBytes
- value uintegerFromBytes
- data Counter
- value newCounter
- value readCounter
- value writeCounter
- value incCounter
- value decCounter
- value copyByteStringToByteArray
- value copyByteArrayToByteString
- Packagecborg-0.2.10.0
- Exports34
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceMagic.hs
Word utilities
ByteString utilities
Take the tail of a ByteString (i.e. drop the first byte) and read the resulting byte(s) as an 8-bit word value. The input ByteString MUST be at least 2 bytes long: one byte to drop from the front, and one to read as a Word value. This is not checked, and failure to ensure this will result in undefined behavior.
Take the tail of a ByteString (i.e. drop the first byte) and read the resulting byte(s) as a 16-bit word value. The input ByteString MUST be at least 3 bytes long: one byte to drop from the front, and two to read as a 16-bit Word value. This is not checked, and failure to ensure this will result in undefined behavior.
Take the tail of a ByteString (i.e. drop the first byte) and read the resulting byte(s) as a 32-bit word value. The input ByteString MUST be at least 5 bytes long: one byte to drop from the front, and four to read as a 32-bit Word value. This is not checked, and failure to ensure this will result in undefined behavior.
Take the tail of a ByteString (i.e. drop the first byte) and read the resulting byte(s) as a 64-bit word value. The input ByteString MUST be at least 9 bytes long: one byte to drop from the front, and eight to read as a 64-bit Word64 value. This is not checked, and failure to ensure this will result in undefined behavior.
Half-floats
Float/Word conversion
Int and Word explicit conversions
Integer utilities
Create a negative Integer out of a raw ByteString.
Create an Integer out of a raw ByteString.
Simple mutable counters
An efficient, mutable counter. Designed to be used inside
ST or other primitive monads, hence it carries an abstract
rank-2 s type parameter.
Create a new counter with a starting Int value.
Read the current value of a Counter.
Write a new value into the Counter.
Increment a Counter by one.
Decrement a Counter by one.
Array support
Copy a ByteString and create a primitive ByteArray from it.
Copy a ByteArray at a certain offset and length into a ByteString.