|
Blaze.ByteString.Builder.Word | Portability | tested on GHC only | Stability | experimental | Maintainer | Simon Meier <iridcode@gmail.com> |
|
|
|
|
|
Description |
Writes and Builders for serializing words.
Note that for serializing a three tuple (x,y,z) of bytes (or other word
values) you should use the expression
fromWrite $ writeWord8 x `mappend` writeWord8 y `mappend` writeWord z
instead of
fromWord8 x `mappend` fromWord8 y `mappend` fromWord z
The first expression will result in a single atomic write of three bytes,
while the second expression will check for each byte, if there is free space
left in the output buffer. Coalescing these checks can improve performance
quite a bit, as long as you use it sensibly.
|
|
Synopsis |
|
|
|
|
Writing words to a buffer
|
|
|
Write a single byte.
|
|
Big-endian writes
|
|
|
Write a Word16 in big endian format.
|
|
|
Write a Word32 in big endian format.
|
|
|
Write a Word64 in big endian format.
|
|
Little-endian writes
|
|
|
Write a Word16 in little endian format.
|
|
|
Write a Word32 in little endian format.
|
|
|
Write a Word64 in little endian format.
|
|
Host-endian writes
|
|
|
Write a single native machine Word. The Word is written in host order,
host endian form, for the machine you're on. On a 64 bit machine the Word
is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way
are not portable to different endian or word sized machines, without
conversion.
|
|
|
Write a Word16 in native host order and host endianness.
|
|
|
Write a Word32 in native host order and host endianness.
|
|
|
Write a Word64 in native host order and host endianness.
|
|
Creating builders from words
|
|
We provide serialization functions both for singleton words as well as
for lists of words. Using these list serialization functions is much faster
than using mconcat . map fromWord<n>, as the list serialization
functions use a tighter inner loop.
|
|
|
Serialize a single byte.
|
|
|
Serialize a list of bytes.
|
|
Big-endian serialization
|
|
|
Serialize a Word16 in big endian format.
|
|
|
Serialize a Word32 in big endian format.
|
|
|
Serialize a Word64 in big endian format.
|
|
|
Serialize a list of Word32s in big endian format.
|
|
|
Serialize a list of Word16s in big endian format.
|
|
|
Serialize a list of Word64s in big endian format.
|
|
Little-endian serialization
|
|
|
Serialize a Word16 in little endian format.
|
|
|
Serialize a Word32 in little endian format.
|
|
|
Serialize a Word64 in little endian format.
|
|
|
Serialize a list of Word16s in little endian format.
|
|
|
Serialize a list of Word32s in little endian format.
|
|
|
Serialize a list of Word64s in little endian format.
|
|
Host-endian serialization
|
|
|
Serialize a single native machine Word. The Word is serialized in host
order, host endian form, for the machine you're on. On a 64 bit machine the
Word is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this
way are not portable to different endian or word sized machines, without
conversion.
|
|
|
Write a Word16 in native host order and host endianness.
|
|
|
Write a Word32 in native host order and host endianness.
|
|
|
Write a Word64 in native host order and host endianness.
|
|
|
Serialize a list of Words.
See fromWordhost for usage considerations.
|
|
|
Write a list of Word16s in native host order and host endianness.
|
|
|
Write a list of Word32s in native host order and host endianness.
|
|
|
Write a list of Word64s in native host order and host endianness.
|
|
Produced by Haddock version 2.6.1 |