<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>Blaze/ByteString/Builder/Word.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-2"></a><span class='hs-comment'>-- |</span>
<a name="line-3"></a><span class='hs-comment'>-- Module:      Blaze.ByteString.Builder.Word</span>
<a name="line-4"></a><span class='hs-comment'>-- Copyright:   (c) 2013 Leon P Smith</span>
<a name="line-5"></a><span class='hs-comment'>-- License:     BSD3</span>
<a name="line-6"></a><span class='hs-comment'>-- Maintainer:  Leon P Smith &lt;leon@melding-monads.com&gt;</span>
<a name="line-7"></a><span class='hs-comment'>-- Stability:   experimental</span>
<a name="line-8"></a><span class='hs-comment'>--</span>
<a name="line-9"></a><span class='hs-comment'>-- 'Write's and 'Builder's for serializing words.</span>
<a name="line-10"></a><span class='hs-comment'>--</span>
<a name="line-11"></a><span class='hs-comment'>-- Note that for serializing a three tuple @(x,y,z)@ of bytes (or other word</span>
<a name="line-12"></a><span class='hs-comment'>-- values) you should use the expression</span>
<a name="line-13"></a><span class='hs-comment'>--</span>
<a name="line-14"></a><span class='hs-comment'>-- &gt; fromWrite $ writeWord8 x `mappend` writeWord8 y `mappend` writeWord z</span>
<a name="line-15"></a><span class='hs-comment'>--</span>
<a name="line-16"></a><span class='hs-comment'>-- instead of</span>
<a name="line-17"></a><span class='hs-comment'>--</span>
<a name="line-18"></a><span class='hs-comment'>-- &gt; fromWord8 x `mappend` fromWord8 y `mappend` fromWord z</span>
<a name="line-19"></a><span class='hs-comment'>--</span>
<a name="line-20"></a><span class='hs-comment'>-- The first expression will result in a single atomic write of three bytes,</span>
<a name="line-21"></a><span class='hs-comment'>-- while the second expression will check for each byte, if there is free space</span>
<a name="line-22"></a><span class='hs-comment'>-- left in the output buffer. Coalescing these checks can improve performance</span>
<a name="line-23"></a><span class='hs-comment'>-- quite a bit, as long as you use it sensibly.</span>
<a name="line-24"></a><span class='hs-comment'>--</span>
<a name="line-25"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-26"></a>
<a name="line-27"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Blaze</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span>
<a name="line-28"></a>    <span class='hs-layout'>(</span>
<a name="line-29"></a>    <span class='hs-comment'>-- * Writing words to a buffer</span>
<a name="line-30"></a>
<a name="line-31"></a>      <span class='hs-varid'>writeWord8</span>
<a name="line-32"></a>
<a name="line-33"></a>    <span class='hs-comment'>-- ** Big-endian writes</span>
<a name="line-34"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord16be</span>           <span class='hs-comment'>-- :: Word16 -&gt; Write</span>
<a name="line-35"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord32be</span>           <span class='hs-comment'>-- :: Word32 -&gt; Write</span>
<a name="line-36"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord64be</span>           <span class='hs-comment'>-- :: Word64 -&gt; Write</span>
<a name="line-37"></a>
<a name="line-38"></a>    <span class='hs-comment'>-- ** Little-endian writes</span>
<a name="line-39"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord16le</span>           <span class='hs-comment'>-- :: Word16 -&gt; Write</span>
<a name="line-40"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord32le</span>           <span class='hs-comment'>-- :: Word32 -&gt; Write</span>
<a name="line-41"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord64le</span>           <span class='hs-comment'>-- :: Word64 -&gt; Write</span>
<a name="line-42"></a>
<a name="line-43"></a>    <span class='hs-comment'>-- ** Host-endian writes</span>
<a name="line-44"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWordhost</span>           <span class='hs-comment'>-- :: Word -&gt; Write</span>
<a name="line-45"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord16host</span>         <span class='hs-comment'>-- :: Word16 -&gt; Write</span>
<a name="line-46"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord32host</span>         <span class='hs-comment'>-- :: Word32 -&gt; Write</span>
<a name="line-47"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>writeWord64host</span>         <span class='hs-comment'>-- :: Word64 -&gt; Write</span>
<a name="line-48"></a>
<a name="line-49"></a>    <span class='hs-comment'>-- * Creating builders from words</span>
<a name="line-50"></a>
<a name="line-51"></a>    <span class='hs-comment'>-- | We provide serialization functions both for singleton words as well as</span>
<a name="line-52"></a>    <span class='hs-comment'>-- for lists of words. Using these list serialization functions is /much/ faster</span>
<a name="line-53"></a>    <span class='hs-comment'>-- than using @mconcat . map fromWord/&lt;n/&gt;@, as the list serialization</span>
<a name="line-54"></a>    <span class='hs-comment'>-- functions use a tighter inner loop.</span>
<a name="line-55"></a>
<a name="line-56"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord8</span>
<a name="line-57"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord8s</span>
<a name="line-58"></a>
<a name="line-59"></a>    <span class='hs-comment'>-- ** Big-endian serialization</span>
<a name="line-60"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16be</span>            <span class='hs-comment'>-- :: Word16   -&gt; Builder</span>
<a name="line-61"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32be</span>            <span class='hs-comment'>-- :: Word32   -&gt; Builder</span>
<a name="line-62"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64be</span>            <span class='hs-comment'>-- :: Word64   -&gt; Builder</span>
<a name="line-63"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32sbe</span>           <span class='hs-comment'>-- :: [Word32] -&gt; Builder</span>
<a name="line-64"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16sbe</span>           <span class='hs-comment'>-- :: [Word16] -&gt; Builder</span>
<a name="line-65"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64sbe</span>           <span class='hs-comment'>-- :: [Word64] -&gt; Builder</span>
<a name="line-66"></a>
<a name="line-67"></a>    <span class='hs-comment'>-- ** Little-endian serialization</span>
<a name="line-68"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16le</span>            <span class='hs-comment'>-- :: Word16   -&gt; Builder</span>
<a name="line-69"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32le</span>            <span class='hs-comment'>-- :: Word32   -&gt; Builder</span>
<a name="line-70"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64le</span>            <span class='hs-comment'>-- :: Word64   -&gt; Builder</span>
<a name="line-71"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16sle</span>           <span class='hs-comment'>-- :: [Word16] -&gt; Builder</span>
<a name="line-72"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32sle</span>           <span class='hs-comment'>-- :: [Word32] -&gt; Builder</span>
<a name="line-73"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64sle</span>           <span class='hs-comment'>-- :: [Word64] -&gt; Builder</span>
<a name="line-74"></a>
<a name="line-75"></a>    <span class='hs-comment'>-- ** Host-endian serialization</span>
<a name="line-76"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWordhost</span>            <span class='hs-comment'>-- :: Word     -&gt; Builder</span>
<a name="line-77"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16host</span>          <span class='hs-comment'>-- :: Word16   -&gt; Builder</span>
<a name="line-78"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32host</span>          <span class='hs-comment'>-- :: Word32   -&gt; Builder</span>
<a name="line-79"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64host</span>          <span class='hs-comment'>-- :: Word64   -&gt; Builder</span>
<a name="line-80"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWordshost</span>           <span class='hs-comment'>-- :: [Word]   -&gt; Builder</span>
<a name="line-81"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord16shost</span>         <span class='hs-comment'>-- :: [Word16] -&gt; Builder</span>
<a name="line-82"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord32shost</span>         <span class='hs-comment'>-- :: [Word32] -&gt; Builder</span>
<a name="line-83"></a>    <span class='hs-layout'>,</span> <span class='hs-varid'>fromWord64shost</span>         <span class='hs-comment'>-- :: [Word64] -&gt; Builder</span>
<a name="line-84"></a>
<a name="line-85"></a>    <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-86"></a>
<a name="line-87"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Word</span>
<a name="line-88"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Blaze</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-conid'>Compat</span><span class='hs-varop'>.</span><span class='hs-conid'>Write</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Write</span><span class='hs-layout'>,</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-layout'>)</span>
<a name="line-89"></a><span class='hs-keyword'>import</span>           <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span> <span class='hs-layout'>(</span> <span class='hs-conid'>Builder</span> <span class='hs-layout'>)</span>
<a name="line-90"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span>       <span class='hs-keyword'>as</span> <span class='hs-conid'>B</span>
<a name="line-91"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-conid'>Extra</span> <span class='hs-keyword'>as</span> <span class='hs-conid'>B</span>
<a name="line-92"></a><span class='hs-keyword'>import</span> <span class='hs-keyword'>qualified</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>ByteString</span><span class='hs-varop'>.</span><span class='hs-conid'>Builder</span><span class='hs-varop'>.</span><span class='hs-conid'>Prim</span>  <span class='hs-keyword'>as</span> <span class='hs-conid'>P</span>
<a name="line-93"></a>
<a name="line-94"></a><a name="writeWord8"></a><span class='hs-comment'>-- | Write a single byte.</span>
<a name="line-95"></a><span class='hs-comment'>--</span>
<a name="line-96"></a><span class='hs-definition'>writeWord8</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word8</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-97"></a><span class='hs-definition'>writeWord8</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word8</span>
<a name="line-98"></a><span class='hs-comment'>{-# INLINE writeWord8 #-}</span>
<a name="line-99"></a>
<a name="line-100"></a><a name="writeWord16be"></a><span class='hs-comment'>-- | Write a 'Word16' in big endian format.</span>
<a name="line-101"></a><span class='hs-definition'>writeWord16be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-102"></a><span class='hs-definition'>writeWord16be</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16BE</span>
<a name="line-103"></a><span class='hs-comment'>{-# INLINE writeWord16be #-}</span>
<a name="line-104"></a>
<a name="line-105"></a><a name="writeWord32be"></a><span class='hs-comment'>-- | Write a 'Word32' in big endian format.</span>
<a name="line-106"></a><span class='hs-definition'>writeWord32be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-107"></a><span class='hs-definition'>writeWord32be</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32BE</span>
<a name="line-108"></a><span class='hs-comment'>{-# INLINE writeWord32be #-}</span>
<a name="line-109"></a>
<a name="line-110"></a><a name="writeWord64be"></a><span class='hs-comment'>-- | Write a 'Word64' in big endian format.</span>
<a name="line-111"></a><span class='hs-definition'>writeWord64be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-112"></a><span class='hs-definition'>writeWord64be</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64BE</span>
<a name="line-113"></a><span class='hs-comment'>{-# INLINE writeWord64be #-}</span>
<a name="line-114"></a>
<a name="line-115"></a><a name="writeWord16le"></a><span class='hs-comment'>-- | Write a 'Word16' in little endian format.</span>
<a name="line-116"></a><span class='hs-definition'>writeWord16le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-117"></a><span class='hs-definition'>writeWord16le</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16LE</span>
<a name="line-118"></a><span class='hs-comment'>{-# INLINE writeWord16le #-}</span>
<a name="line-119"></a>
<a name="line-120"></a><a name="writeWord32le"></a><span class='hs-comment'>-- | Write a 'Word32' in big endian format.</span>
<a name="line-121"></a><span class='hs-definition'>writeWord32le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-122"></a><span class='hs-definition'>writeWord32le</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32LE</span>
<a name="line-123"></a><span class='hs-comment'>{-# INLINE writeWord32le #-}</span>
<a name="line-124"></a>
<a name="line-125"></a><a name="writeWord64le"></a><span class='hs-comment'>-- | Write a 'Word64' in little endian format.</span>
<a name="line-126"></a><span class='hs-definition'>writeWord64le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-127"></a><span class='hs-definition'>writeWord64le</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64LE</span>
<a name="line-128"></a><span class='hs-comment'>{-# INLINE writeWord64le #-}</span>
<a name="line-129"></a>
<a name="line-130"></a><a name="writeWordhost"></a><span class='hs-comment'>-- | Write a single native machine 'Word'. The 'Word' is written in host order,</span>
<a name="line-131"></a><span class='hs-comment'>-- host endian form, for the machine you're on. On a 64 bit machine the 'Word'</span>
<a name="line-132"></a><span class='hs-comment'>-- is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this way</span>
<a name="line-133"></a><span class='hs-comment'>-- are not portable to different endian or word sized machines, without</span>
<a name="line-134"></a><span class='hs-comment'>-- conversion.</span>
<a name="line-135"></a><span class='hs-comment'>--</span>
<a name="line-136"></a><span class='hs-definition'>writeWordhost</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-137"></a><span class='hs-definition'>writeWordhost</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>wordHost</span>
<a name="line-138"></a><span class='hs-comment'>{-# INLINE writeWordhost #-}</span>
<a name="line-139"></a>
<a name="line-140"></a><a name="writeWord16host"></a><span class='hs-comment'>-- | Write a 'Word16' in native host order and host endianness.</span>
<a name="line-141"></a><span class='hs-definition'>writeWord16host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-142"></a><span class='hs-definition'>writeWord16host</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16Host</span>
<a name="line-143"></a><span class='hs-comment'>{-# INLINE writeWord16host #-}</span>
<a name="line-144"></a>
<a name="line-145"></a><a name="writeWord32host"></a><span class='hs-comment'>-- | Write a 'Word32' in native host order and host endianness.</span>
<a name="line-146"></a><span class='hs-definition'>writeWord32host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-147"></a><span class='hs-definition'>writeWord32host</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32Host</span>
<a name="line-148"></a><span class='hs-comment'>{-# INLINE writeWord32host #-}</span>
<a name="line-149"></a>
<a name="line-150"></a><a name="writeWord64host"></a><span class='hs-comment'>-- | Write a 'Word64' in native host order and host endianness.</span>
<a name="line-151"></a><span class='hs-definition'>writeWord64host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Write</span>
<a name="line-152"></a><span class='hs-definition'>writeWord64host</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>writePrimFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64Host</span>
<a name="line-153"></a><span class='hs-comment'>{-# INLINE writeWord64host #-}</span>
<a name="line-154"></a>
<a name="line-155"></a><a name="fromWord8"></a><span class='hs-comment'>-- | Serialize a single byte.</span>
<a name="line-156"></a><span class='hs-definition'>fromWord8</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word8</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-157"></a><span class='hs-definition'>fromWord8</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word8</span>
<a name="line-158"></a><span class='hs-comment'>{-# INLINE fromWord8 #-}</span>
<a name="line-159"></a>
<a name="line-160"></a><a name="fromWord8s"></a><span class='hs-comment'>-- | Serialize a list of bytes.</span>
<a name="line-161"></a><span class='hs-definition'>fromWord8s</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word8</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-162"></a><span class='hs-definition'>fromWord8s</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word8</span>
<a name="line-163"></a><span class='hs-comment'>{-# INLINE fromWord8s #-}</span>
<a name="line-164"></a>
<a name="line-165"></a><a name="fromWord16be"></a><span class='hs-comment'>-- | Serialize a 'Word16' in big endian format.</span>
<a name="line-166"></a><span class='hs-definition'>fromWord16be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-167"></a><span class='hs-definition'>fromWord16be</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word16BE</span>
<a name="line-168"></a><span class='hs-comment'>{-# INLINE fromWord16be #-}</span>
<a name="line-169"></a>
<a name="line-170"></a><a name="fromWord32be"></a><span class='hs-comment'>-- | Serialize a 'Word32' in big endian format.</span>
<a name="line-171"></a><span class='hs-definition'>fromWord32be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-172"></a><span class='hs-definition'>fromWord32be</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word32BE</span>
<a name="line-173"></a><span class='hs-comment'>{-# INLINE fromWord32be #-}</span>
<a name="line-174"></a>
<a name="line-175"></a><a name="fromWord64be"></a><span class='hs-comment'>-- | Serialize a 'Word64' in big endian format.</span>
<a name="line-176"></a><span class='hs-definition'>fromWord64be</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-177"></a><span class='hs-definition'>fromWord64be</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word64BE</span>
<a name="line-178"></a><span class='hs-comment'>{-# INLINE fromWord64be #-}</span>
<a name="line-179"></a>
<a name="line-180"></a><a name="fromWord32sbe"></a><span class='hs-comment'>-- | Serialize a list of 'Word32's in big endian format.</span>
<a name="line-181"></a><span class='hs-definition'>fromWord32sbe</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word32</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-182"></a><span class='hs-definition'>fromWord32sbe</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32BE</span>
<a name="line-183"></a><span class='hs-comment'>{-# INLINE fromWord32sbe #-}</span>
<a name="line-184"></a>
<a name="line-185"></a><a name="fromWord16sbe"></a><span class='hs-comment'>-- | Serialize a list of 'Word16's in big endian format.</span>
<a name="line-186"></a><span class='hs-definition'>fromWord16sbe</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word16</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-187"></a><span class='hs-definition'>fromWord16sbe</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16BE</span>
<a name="line-188"></a><span class='hs-comment'>{-# INLINE fromWord16sbe #-}</span>
<a name="line-189"></a>
<a name="line-190"></a><a name="fromWord64sbe"></a><span class='hs-comment'>-- | Serialize a list of 'Word64's in big endian format.</span>
<a name="line-191"></a><span class='hs-definition'>fromWord64sbe</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-192"></a><span class='hs-definition'>fromWord64sbe</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64BE</span>
<a name="line-193"></a><span class='hs-comment'>{-# INLINE fromWord64sbe #-}</span>
<a name="line-194"></a>
<a name="line-195"></a><a name="fromWord16le"></a><span class='hs-comment'>-- | Serialize a 'Word16' in little endian format.</span>
<a name="line-196"></a><span class='hs-definition'>fromWord16le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-197"></a><span class='hs-definition'>fromWord16le</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word16LE</span>
<a name="line-198"></a><span class='hs-comment'>{-# INLINE fromWord16le #-}</span>
<a name="line-199"></a>
<a name="line-200"></a><a name="fromWord32le"></a><span class='hs-comment'>-- | Serialize a list of 'Word32's in little endian format.</span>
<a name="line-201"></a><span class='hs-definition'>fromWord32le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-202"></a><span class='hs-definition'>fromWord32le</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word32LE</span>
<a name="line-203"></a><span class='hs-comment'>{-# INLINE fromWord32le #-}</span>
<a name="line-204"></a>
<a name="line-205"></a><a name="fromWord64le"></a><span class='hs-comment'>-- | Serialize a 'Word64' in little endian format.</span>
<a name="line-206"></a><span class='hs-definition'>fromWord64le</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-207"></a><span class='hs-definition'>fromWord64le</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word64LE</span>
<a name="line-208"></a><span class='hs-comment'>{-# INLINE fromWord64le #-}</span>
<a name="line-209"></a>
<a name="line-210"></a><a name="fromWord16sle"></a><span class='hs-comment'>-- | Serialize a list of 'Word16's in little endian format.</span>
<a name="line-211"></a><span class='hs-definition'>fromWord16sle</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word16</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-212"></a><span class='hs-definition'>fromWord16sle</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16LE</span>
<a name="line-213"></a><span class='hs-comment'>{-# INLINE fromWord16sle #-}</span>
<a name="line-214"></a>
<a name="line-215"></a><a name="fromWord32sle"></a><span class='hs-comment'>-- | Serialize a list of 'Word32's in little endian format.</span>
<a name="line-216"></a><span class='hs-definition'>fromWord32sle</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word32</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-217"></a><span class='hs-definition'>fromWord32sle</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32LE</span>
<a name="line-218"></a><span class='hs-comment'>{-# INLINE fromWord32sle #-}</span>
<a name="line-219"></a>
<a name="line-220"></a><a name="fromWord64sle"></a><span class='hs-comment'>-- | Serialize a list of 'Word64's in little endian format.</span>
<a name="line-221"></a><span class='hs-definition'>fromWord64sle</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-222"></a><span class='hs-definition'>fromWord64sle</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64LE</span>
<a name="line-223"></a><span class='hs-comment'>{-# INLINE fromWord64sle #-}</span>
<a name="line-224"></a>
<a name="line-225"></a><a name="fromWordhost"></a><span class='hs-comment'>-- | Serialize a single native machine 'Word'. The 'Word' is serialized in host</span>
<a name="line-226"></a><span class='hs-comment'>-- order, host endian form, for the machine you're on. On a 64 bit machine the</span>
<a name="line-227"></a><span class='hs-comment'>-- 'Word' is an 8 byte value, on a 32 bit machine, 4 bytes. Values written this</span>
<a name="line-228"></a><span class='hs-comment'>-- way are not portable to different endian or word sized machines, without</span>
<a name="line-229"></a><span class='hs-comment'>-- conversion.</span>
<a name="line-230"></a><span class='hs-definition'>fromWordhost</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word</span>     <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-231"></a><span class='hs-definition'>fromWordhost</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>wordHost</span>
<a name="line-232"></a><span class='hs-comment'>{-# INLINE fromWordhost #-}</span>
<a name="line-233"></a>
<a name="line-234"></a><a name="fromWord16host"></a><span class='hs-comment'>-- | Write a 'Word16' in native host order and host endianness.</span>
<a name="line-235"></a><span class='hs-definition'>fromWord16host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word16</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-236"></a><span class='hs-definition'>fromWord16host</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word16Host</span>
<a name="line-237"></a><span class='hs-comment'>{-# INLINE fromWord16host #-}</span>
<a name="line-238"></a>
<a name="line-239"></a><a name="fromWord32host"></a><span class='hs-comment'>-- | Write a 'Word32' in native host order and host endianness.</span>
<a name="line-240"></a><span class='hs-definition'>fromWord32host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word32</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-241"></a><span class='hs-definition'>fromWord32host</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word32Host</span>
<a name="line-242"></a><span class='hs-comment'>{-# INLINE fromWord32host #-}</span>
<a name="line-243"></a>
<a name="line-244"></a><a name="fromWord64host"></a><span class='hs-comment'>-- | Write a 'Word64' in native host order and host endianness.</span>
<a name="line-245"></a><span class='hs-definition'>fromWord64host</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Word64</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-246"></a><span class='hs-definition'>fromWord64host</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>B</span><span class='hs-varop'>.</span><span class='hs-varid'>word64Host</span>
<a name="line-247"></a><span class='hs-comment'>{-# INLINE fromWord64host #-}</span>
<a name="line-248"></a>
<a name="line-249"></a><a name="fromWordshost"></a><span class='hs-comment'>-- | Serialize a list of 'Word's.</span>
<a name="line-250"></a><span class='hs-comment'>-- See 'fromWordhost' for usage considerations.</span>
<a name="line-251"></a><span class='hs-definition'>fromWordshost</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word</span><span class='hs-keyglyph'>]</span>   <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-252"></a><span class='hs-definition'>fromWordshost</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>wordHost</span>
<a name="line-253"></a><span class='hs-comment'>{-# INLINE fromWordshost #-}</span>
<a name="line-254"></a>
<a name="line-255"></a><a name="fromWord16shost"></a><span class='hs-comment'>-- | Write a list of 'Word16's in native host order and host endianness.</span>
<a name="line-256"></a><span class='hs-definition'>fromWord16shost</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word16</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-257"></a><span class='hs-definition'>fromWord16shost</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word16Host</span>
<a name="line-258"></a><span class='hs-comment'>{-# INLINE fromWord16shost #-}</span>
<a name="line-259"></a>
<a name="line-260"></a><a name="fromWord32shost"></a><span class='hs-comment'>-- | Write a list of 'Word32's in native host order and host endianness.</span>
<a name="line-261"></a><span class='hs-definition'>fromWord32shost</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word32</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-262"></a><span class='hs-definition'>fromWord32shost</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word32Host</span>
<a name="line-263"></a><span class='hs-comment'>{-# INLINE fromWord32shost #-}</span>
<a name="line-264"></a>
<a name="line-265"></a><a name="fromWord64shost"></a><span class='hs-comment'>-- | Write a 'Word64' in native host order and host endianness.</span>
<a name="line-266"></a><span class='hs-definition'>fromWord64shost</span> <span class='hs-keyglyph'>::</span> <span class='hs-keyglyph'>[</span><span class='hs-conid'>Word64</span><span class='hs-keyglyph'>]</span> <span class='hs-keyglyph'>-&gt;</span> <span class='hs-conid'>Builder</span>
<a name="line-267"></a><span class='hs-definition'>fromWord64shost</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>primMapListFixed</span> <span class='hs-conid'>P</span><span class='hs-varop'>.</span><span class='hs-varid'>word64Host</span>
<a name="line-268"></a><span class='hs-comment'>{-# INLINE fromWord64shost #-}</span>
</pre></body>
</html>
