<h4>Statistics:</h4>
<table class="simple">
<tr><th>kind</th><th width="16px"> </th><th>coverage</th></tr>
- <tr><td>binding</td><td width="16px"> </td><td>119 / 231 (51 %)</td></tr>
- <tr><td>sequence</td><td width="16px"> </td><td>37 / 93 (39 %)</td></tr>
+ <tr><td>binding</td><td width="16px"> </td><td>149 / 245 (60 %)</td></tr>
+ <tr><td>sequence</td><td width="16px"> </td><td>60 / 95 (63 %)</td></tr>
<tr><td>for</td><td width="16px"> </td><td>3 / 5 (60 %)</td></tr>
- <tr><td>if/then</td><td width="16px"> </td><td>72 / 163 (44 %)</td></tr>
- <tr><td>try</td><td width="16px"> </td><td>0 / 2 (0 %)</td></tr>
- <tr><td>while</td><td width="16px"> </td><td>0 / 3 (0 %)</td></tr>
- <tr><td>match/function</td><td width="16px"> </td><td>41 / 77 (53 %)</td></tr>
+ <tr><td>if/then</td><td width="16px"> </td><td>100 / 193 (51 %)</td></tr>
+ <tr><td>try</td><td width="16px"> </td><td>1 / 2 (50 %)</td></tr>
+ <tr><td>while</td><td width="16px"> </td><td>2 / 3 (66 %)</td></tr>
+ <tr><td>match/function</td><td width="16px"> </td><td>53 / 88 (60 %)</td></tr>
<tr><td>class expression</td><td width="16px"> </td><td>0 / 0 (- %)</td></tr>
<tr><td>class initializer</td><td width="16px"> </td><td>0 / 0 (- %)</td></tr>
<tr><td>class method</td><td width="16px"> </td><td>0 / 0 (- %)</td></tr>
<div class="lineNone">000016| * License along with this library; if not, write to the Free Software</div>
<div class="lineNone">000017| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</div>
<div class="lineNone">000018| *</div>
- <div class="lineNone">000019| * $Id: bitstring.ml 153 2008-08-26 08:24:31Z richard.wm.jones $</div>
+ <div class="lineNone">000019| * $Id: bitstring.ml 156 2008-08-26 09:42:05Z richard.wm.jones $</div>
<div class="lineNone">000020| *)</div>
<div class="lineNone">000021| </div>
<div class="lineNone">000022| open Printf</div>
<div class="lineNone">000027| (* Enable runtime debug messages. Must also have been enabled</div>
<div class="lineNone">000028| * in pa_bitstring.ml.</div>
<div class="lineNone">000029| *)</div>
- <div class="lineAllVisited">000030| let debug = (*[28]*)ref false</div>
+ <div class="lineAllVisited">000030| let debug = (*[34]*)ref false</div>
<div class="lineNone">000031| </div>
<div class="lineNone">000032| (* Exceptions. *)</div>
<div class="lineNone">000033| exception Construct_failure of string * string * int * int</div>
<div class="lineNone">000038| *)</div>
<div class="lineNone">000039| type bitstring = string * int * int</div>
<div class="lineNone">000040| </div>
- <div class="lineNone">000041| (* Functions to create and load bitstrings. *)</div>
- <div class="lineAllVisited">000042| let empty_bitstring = (*[28]*)"", 0, 0</div>
- <div class="lineNone">000043| </div>
- <div class="lineNone">000044| let make_bitstring len c =</div>
- <div class="lineAllVisited">000045| (*[1197538]*)if len >= 0 then (*[1197538]*)String.make ((len+7) lsr 3) c, 0, len</div>
- <div class="lineNone">000046| else</div>
- <div class="lineAllUnvisited">000047| (*[0]*)invalid_arg (</div>
- <div class="lineNone">000048| sprintf "make_bitstring/create_bitstring: len %d < 0" len</div>
- <div class="lineNone">000049| )</div>
- <div class="lineNone">000050| </div>
- <div class="lineAllVisited">000051| let create_bitstring len = (*[1]*)make_bitstring len '\000'</div>
+ <div class="lineNone">000041| type t = bitstring</div>
+ <div class="lineNone">000042| </div>
+ <div class="lineNone">000043| (* Functions to create and load bitstrings. *)</div>
+ <div class="lineAllVisited">000044| let empty_bitstring = (*[34]*)"", 0, 0</div>
+ <div class="lineNone">000045| </div>
+ <div class="lineNone">000046| let make_bitstring len c =</div>
+ <div class="lineAllVisited">000047| (*[1325857]*)if len >= 0 then (*[1325857]*)String.make ((len+7) lsr 3) c, 0, len</div>
+ <div class="lineNone">000048| else</div>
+ <div class="lineAllUnvisited">000049| (*[0]*)invalid_arg (</div>
+ <div class="lineNone">000050| sprintf "make_bitstring/create_bitstring: len %d < 0" len</div>
+ <div class="lineNone">000051| )</div>
<div class="lineNone">000052| </div>
- <div class="lineAllVisited">000053| let zeroes_bitstring = (*[28]*)create_bitstring</div>
+ <div class="lineAllVisited">000053| let create_bitstring len = (*[42773]*)make_bitstring len '\000'</div>
<div class="lineNone">000054| </div>
- <div class="lineAllVisited">000055| let ones_bitstring len = (*[1197537]*)make_bitstring len '\xff'</div>
+ <div class="lineAllVisited">000055| let zeroes_bitstring = (*[34]*)create_bitstring</div>
<div class="lineNone">000056| </div>
- <div class="lineAllVisited">000057| let bitstring_of_string str = (*[2]*)str, 0, String.length str lsl 3</div>
+ <div class="lineAllVisited">000057| let ones_bitstring len = (*[1278457]*)make_bitstring len '\xff'</div>
<div class="lineNone">000058| </div>
- <div class="lineNone">000059| let bitstring_of_chan chan =</div>
- <div class="lineAllUnvisited">000060| (*[0]*)let tmpsize = 16384 in</div>
- <div class="lineAllUnvisited">000061| (*[0]*)let buf = Buffer.create tmpsize in</div>
- <div class="lineAllUnvisited">000062| (*[0]*)let tmp = String.create tmpsize in</div>
- <div class="lineAllUnvisited">000063| (*[0]*)let n = ref 0 in</div>
- <div class="lineAllUnvisited">000064| (*[0]*)while (*[0]*)n := input chan tmp 0 tmpsize; !(*[0]*)n > 0 do</div>
- <div class="lineAllUnvisited">000065| (*[0]*)Buffer.add_substring buf tmp 0 !n;</div>
- <div class="lineNone">000066| done;</div>
- <div class="lineAllUnvisited">000067| (*[0]*)Buffer.contents buf, 0, Buffer.length buf lsl 3</div>
- <div class="lineNone">000068| </div>
- <div class="lineNone">000069| let bitstring_of_chan_max chan max =</div>
- <div class="lineAllUnvisited">000070| (*[0]*)let tmpsize = 16384 in</div>
- <div class="lineAllUnvisited">000071| (*[0]*)let buf = Buffer.create tmpsize in</div>
- <div class="lineAllUnvisited">000072| (*[0]*)let tmp = String.create tmpsize in</div>
- <div class="lineAllUnvisited">000073| (*[0]*)let len = ref 0 in</div>
- <div class="lineAllUnvisited">000074| (*[0]*)let rec loop () =</div>
- <div class="lineAllUnvisited">000075| (*[0]*)if !len < max then (</div>
- <div class="lineAllUnvisited">000076| (*[0]*)let r = min tmpsize (max - !len) in</div>
- <div class="lineAllUnvisited">000077| (*[0]*)let n = input chan tmp 0 r in</div>
- <div class="lineAllUnvisited">000078| (*[0]*)if n > 0 then (</div>
- <div class="lineAllUnvisited">000079| (*[0]*)Buffer.add_substring buf tmp 0 n;</div>
- <div class="lineAllUnvisited">000080| (*[0]*)len (*[0]*):= !len + n;</div>
- <div class="lineAllUnvisited">000081| (*[0]*)loop ()</div>
- <div class="lineNone">000082| )</div>
- <div class="lineNone">000083| )</div>
- <div class="lineNone">000084| in</div>
- <div class="lineAllUnvisited">000085| (*[0]*)loop (*[0]*)();</div>
- <div class="lineAllUnvisited">000086| (*[0]*)Buffer.contents buf, 0, !len lsl 3</div>
- <div class="lineNone">000087| </div>
- <div class="lineNone">000088| let bitstring_of_file_descr fd =</div>
- <div class="lineAllUnvisited">000089| (*[0]*)let tmpsize = 16384 in</div>
- <div class="lineAllUnvisited">000090| (*[0]*)let buf = Buffer.create tmpsize in</div>
- <div class="lineAllUnvisited">000091| (*[0]*)let tmp = String.create tmpsize in</div>
- <div class="lineAllUnvisited">000092| (*[0]*)let n = ref 0 in</div>
- <div class="lineAllUnvisited">000093| (*[0]*)while (*[0]*)n := Unix.read fd tmp 0 tmpsize; !(*[0]*)n > 0 do</div>
- <div class="lineAllUnvisited">000094| (*[0]*)Buffer.add_substring buf tmp 0 !n;</div>
- <div class="lineNone">000095| done;</div>
- <div class="lineAllUnvisited">000096| (*[0]*)Buffer.contents buf, 0, Buffer.length buf lsl 3</div>
- <div class="lineNone">000097| </div>
- <div class="lineNone">000098| let bitstring_of_file_descr_max fd max =</div>
- <div class="lineAllUnvisited">000099| (*[0]*)let tmpsize = 16384 in</div>
- <div class="lineAllUnvisited">000100| (*[0]*)let buf = Buffer.create tmpsize in</div>
- <div class="lineAllUnvisited">000101| (*[0]*)let tmp = String.create tmpsize in</div>
- <div class="lineAllUnvisited">000102| (*[0]*)let len = ref 0 in</div>
- <div class="lineAllUnvisited">000103| (*[0]*)let rec loop () =</div>
- <div class="lineAllUnvisited">000104| (*[0]*)if !len < max then (</div>
- <div class="lineAllUnvisited">000105| (*[0]*)let r = min tmpsize (max - !len) in</div>
- <div class="lineAllUnvisited">000106| (*[0]*)let n = Unix.read fd tmp 0 r in</div>
- <div class="lineAllUnvisited">000107| (*[0]*)if n > 0 then (</div>
- <div class="lineAllUnvisited">000108| (*[0]*)Buffer.add_substring buf tmp 0 n;</div>
- <div class="lineAllUnvisited">000109| (*[0]*)len (*[0]*):= !len + n;</div>
- <div class="lineAllUnvisited">000110| (*[0]*)loop ()</div>
- <div class="lineNone">000111| )</div>
- <div class="lineNone">000112| )</div>
- <div class="lineNone">000113| in</div>
- <div class="lineAllUnvisited">000114| (*[0]*)loop (*[0]*)();</div>
- <div class="lineAllUnvisited">000115| (*[0]*)Buffer.contents buf, 0, !len lsl 3</div>
- <div class="lineNone">000116| </div>
- <div class="lineNone">000117| let bitstring_of_file fname =</div>
- <div class="lineAllUnvisited">000118| (*[0]*)let chan = open_in_bin fname in</div>
- <div class="lineAllUnvisited">000119| (*[0]*)try</div>
- <div class="lineAllUnvisited">000120| (*[0]*)let bs = bitstring_of_chan chan in</div>
- <div class="lineAllUnvisited">000121| (*[0]*)close_in (*[0]*)chan;</div>
- <div class="lineAllUnvisited">000122| (*[0]*)bs</div>
- <div class="lineNone">000123| with exn -></div>
- <div class="lineAllUnvisited">000124| (*[0]*)close_in (*[0]*)chan;</div>
- <div class="lineAllUnvisited">000125| (*[0]*)raise exn</div>
- <div class="lineNone">000126| </div>
- <div class="lineAllVisited">000127| let bitstring_length (_, _, len) = (*[1523677]*)len</div>
+ <div class="lineAllVisited">000059| let bitstring_of_string str = (*[2]*)str, 0, String.length str lsl 3</div>
+ <div class="lineNone">000060| </div>
+ <div class="lineNone">000061| let bitstring_of_chan chan =</div>
+ <div class="lineAllVisited">000062| (*[2]*)let tmpsize = 16384 in</div>
+ <div class="lineAllVisited">000063| (*[2]*)let buf = Buffer.create tmpsize in</div>
+ <div class="lineAllVisited">000064| (*[2]*)let tmp = String.create tmpsize in</div>
+ <div class="lineAllVisited">000065| (*[2]*)let n = ref 0 in</div>
+ <div class="lineAllVisited">000066| (*[2]*)while (*[4]*)n := input chan tmp 0 tmpsize; !(*[4]*)n > 0 do</div>
+ <div class="lineAllVisited">000067| (*[2]*)Buffer.add_substring buf tmp 0 !n;</div>
+ <div class="lineNone">000068| done;</div>
+ <div class="lineAllVisited">000069| (*[2]*)Buffer.contents buf, 0, Buffer.length buf lsl 3</div>
+ <div class="lineNone">000070| </div>
+ <div class="lineNone">000071| let bitstring_of_chan_max chan max =</div>
+ <div class="lineAllVisited">000072| (*[2]*)let tmpsize = 16384 in</div>
+ <div class="lineAllVisited">000073| (*[2]*)let buf = Buffer.create tmpsize in</div>
+ <div class="lineAllVisited">000074| (*[2]*)let tmp = String.create tmpsize in</div>
+ <div class="lineAllVisited">000075| (*[2]*)let len = ref 0 in</div>
+ <div class="lineAllVisited">000076| (*[2]*)let rec loop () =</div>
+ <div class="lineAllVisited">000077| (*[2]*)if !len < max then (</div>
+ <div class="lineAllVisited">000078| (*[2]*)let r = min tmpsize (max - !len) in</div>
+ <div class="lineAllVisited">000079| (*[2]*)let n = input chan tmp 0 r in</div>
+ <div class="lineAllUnvisited">000080| (*[0]*)if n > 0 then (</div>
+ <div class="lineAllVisited">000081| (*[2]*)Buffer.add_substring buf tmp 0 n;</div>
+ <div class="lineAllVisited">000082| (*[2]*)len (*[2]*):= !len + n;</div>
+ <div class="lineAllVisited">000083| (*[2]*)loop ()</div>
+ <div class="lineNone">000084| )</div>
+ <div class="lineNone">000085| )</div>
+ <div class="lineNone">000086| in</div>
+ <div class="lineAllVisited">000087| (*[2]*)loop (*[2]*)();</div>
+ <div class="lineAllVisited">000088| (*[2]*)Buffer.contents buf, 0, !len lsl 3</div>
+ <div class="lineNone">000089| </div>
+ <div class="lineNone">000090| let bitstring_of_file_descr fd =</div>
+ <div class="lineAllVisited">000091| (*[1]*)let tmpsize = 16384 in</div>
+ <div class="lineAllVisited">000092| (*[1]*)let buf = Buffer.create tmpsize in</div>
+ <div class="lineAllVisited">000093| (*[1]*)let tmp = String.create tmpsize in</div>
+ <div class="lineAllVisited">000094| (*[1]*)let n = ref 0 in</div>
+ <div class="lineAllVisited">000095| (*[1]*)while (*[2]*)n := Unix.read fd tmp 0 tmpsize; !(*[2]*)n > 0 do</div>
+ <div class="lineAllVisited">000096| (*[1]*)Buffer.add_substring buf tmp 0 !n;</div>
+ <div class="lineNone">000097| done;</div>
+ <div class="lineAllVisited">000098| (*[1]*)Buffer.contents buf, 0, Buffer.length buf lsl 3</div>
+ <div class="lineNone">000099| </div>
+ <div class="lineNone">000100| let bitstring_of_file_descr_max fd max =</div>
+ <div class="lineAllVisited">000101| (*[2]*)let tmpsize = 16384 in</div>
+ <div class="lineAllVisited">000102| (*[2]*)let buf = Buffer.create tmpsize in</div>
+ <div class="lineAllVisited">000103| (*[2]*)let tmp = String.create tmpsize in</div>
+ <div class="lineAllVisited">000104| (*[2]*)let len = ref 0 in</div>
+ <div class="lineAllVisited">000105| (*[2]*)let rec loop () =</div>
+ <div class="lineAllVisited">000106| (*[2]*)if !len < max then (</div>
+ <div class="lineAllVisited">000107| (*[2]*)let r = min tmpsize (max - !len) in</div>
+ <div class="lineAllVisited">000108| (*[2]*)let n = Unix.read fd tmp 0 r in</div>
+ <div class="lineAllUnvisited">000109| (*[0]*)if n > 0 then (</div>
+ <div class="lineAllVisited">000110| (*[2]*)Buffer.add_substring buf tmp 0 n;</div>
+ <div class="lineAllVisited">000111| (*[2]*)len (*[2]*):= !len + n;</div>
+ <div class="lineAllVisited">000112| (*[2]*)loop ()</div>
+ <div class="lineNone">000113| )</div>
+ <div class="lineNone">000114| )</div>
+ <div class="lineNone">000115| in</div>
+ <div class="lineAllVisited">000116| (*[2]*)loop (*[2]*)();</div>
+ <div class="lineAllVisited">000117| (*[2]*)Buffer.contents buf, 0, !len lsl 3</div>
+ <div class="lineNone">000118| </div>
+ <div class="lineNone">000119| let bitstring_of_file fname =</div>
+ <div class="lineAllVisited">000120| (*[1]*)let chan = open_in_bin fname in</div>
+ <div class="lineAllVisited">000121| (*[1]*)try</div>
+ <div class="lineAllVisited">000122| (*[1]*)let bs = bitstring_of_chan chan in</div>
+ <div class="lineAllVisited">000123| (*[1]*)close_in (*[1]*)chan;</div>
+ <div class="lineAllVisited">000124| (*[1]*)bs</div>
+ <div class="lineNone">000125| with exn -></div>
+ <div class="lineAllUnvisited">000126| (*[0]*)close_in (*[0]*)chan;</div>
+ <div class="lineAllUnvisited">000127| (*[0]*)raise exn</div>
<div class="lineNone">000128| </div>
- <div class="lineNone">000129| let subbitstring (data, off, len) off' len' =</div>
- <div class="lineAllUnvisited">000130| (*[0]*)let off = off + off' in</div>
- <div class="lineAllUnvisited">000131| (*[0]*)if len < off' + len' then (*[0]*)invalid_arg "subbitstring";</div>
- <div class="lineAllUnvisited">000132| ((*[0]*)data, off, len')</div>
- <div class="lineNone">000133| </div>
- <div class="lineNone">000134| let dropbits n (data, off, len) =</div>
- <div class="lineAllVisited">000135| (*[335487]*)let off = off + n in</div>
- <div class="lineAllVisited">000136| (*[335487]*)let len = len - n in</div>
- <div class="lineMixed">000137| (*[335487]*)if len < 0 then (*[0]*)invalid_arg "dropbits";</div>
- <div class="lineAllVisited">000138| ((*[335487]*)data, off, len)</div>
- <div class="lineNone">000139| </div>
- <div class="lineNone">000140| let takebits n (data, off, len) =</div>
- <div class="lineAllUnvisited">000141| (*[0]*)if len < n then (*[0]*)invalid_arg "takebits";</div>
- <div class="lineAllUnvisited">000142| ((*[0]*)data, off, n)</div>
- <div class="lineNone">000143| </div>
- <div class="lineNone">000144| (*----------------------------------------------------------------------*)</div>
- <div class="lineNone">000145| (* Bitwise functions.</div>
- <div class="lineNone">000146| *</div>
- <div class="lineNone">000147| * We try to isolate all bitwise functions within these modules.</div>
- <div class="lineNone">000148| *)</div>
- <div class="lineNone">000149| </div>
- <div class="lineNone">000150| module I = struct</div>
- <div class="lineNone">000151| (* Bitwise operations on ints. Note that we assume int <= 31 bits. *)</div>
- <div class="lineNone">000152| external (<<<) : int -> int -> int = "%lslint"</div>
- <div class="lineNone">000153| external (>>>) : int -> int -> int = "%lsrint"</div>
- <div class="lineNone">000154| external to_int : int -> int = "%identity"</div>
- <div class="lineAllVisited">000155| let zero = (*[28]*)0</div>
- <div class="lineAllVisited">000156| let one = (*[28]*)1</div>
- <div class="lineAllVisited">000157| let minus_one = (*[28]*)-1</div>
- <div class="lineAllVisited">000158| let ff = (*[28]*)0xff</div>
- <div class="lineNone">000159| </div>
- <div class="lineNone">000160| (* Create a mask 0-31 bits wide. *)</div>
- <div class="lineNone">000161| let mask bits =</div>
- <div class="lineAllVisited">000162| (*[2]*)if bits < 30 then</div>
- <div class="lineAllVisited">000163| ((*[2]*)one <<< bits) - 1</div>
- <div class="lineAllUnvisited">000164| else (*[0]*)if bits = 30 then</div>
- <div class="lineAllUnvisited">000165| (*[0]*)max_int</div>
- <div class="lineAllUnvisited">000166| else (*[0]*)if bits = 31 then</div>
- <div class="lineAllUnvisited">000167| (*[0]*)minus_one</div>
- <div class="lineNone">000168| else</div>
- <div class="lineAllUnvisited">000169| (*[0]*)invalid_arg "Bitstring.I.mask"</div>
- <div class="lineNone">000170| </div>
- <div class="lineNone">000171| (* Byte swap an int of a given size. *)</div>
- <div class="lineNone">000172| let byteswap v bits =</div>
- <div class="lineAllUnvisited">000173| (*[0]*)if bits <= 8 then (*[0]*)v</div>
- <div class="lineAllUnvisited">000174| else (*[0]*)if bits <= 16 then (</div>
- <div class="lineAllUnvisited">000175| (*[0]*)let shift = bits-8 in</div>
- <div class="lineAllUnvisited">000176| (*[0]*)let v1 = v >>> shift in</div>
- <div class="lineAllUnvisited">000177| (*[0]*)let v2 = ((v land (mask shift)) <<< 8) in</div>
- <div class="lineAllUnvisited">000178| v2 (*[0]*)lor v1</div>
- <div class="lineAllUnvisited">000179| ) else (*[0]*)if bits <= 24 then (</div>
- <div class="lineAllUnvisited">000180| (*[0]*)let shift = bits - 16 in</div>
- <div class="lineAllUnvisited">000181| (*[0]*)let v1 = v >>> (8+shift) in</div>
- <div class="lineAllUnvisited">000182| (*[0]*)let v2 = ((v >>> shift) land ff) <<< 8 in</div>
- <div class="lineAllUnvisited">000183| (*[0]*)let v3 = (v land (mask shift)) <<< 16 in</div>
- <div class="lineAllUnvisited">000184| v3 lor v2 (*[0]*)lor v1</div>
- <div class="lineNone">000185| ) else (</div>
- <div class="lineAllUnvisited">000186| (*[0]*)let shift = bits - 24 in</div>
- <div class="lineAllUnvisited">000187| (*[0]*)let v1 = v >>> (16+shift) in</div>
- <div class="lineAllUnvisited">000188| (*[0]*)let v2 = ((v >>> (8+shift)) land ff) <<< 8 in</div>
- <div class="lineAllUnvisited">000189| (*[0]*)let v3 = ((v >>> shift) land ff) <<< 16 in</div>
- <div class="lineAllUnvisited">000190| (*[0]*)let v4 = (v land (mask shift)) <<< 24 in</div>
- <div class="lineAllUnvisited">000191| v4 lor v3 lor v2 (*[0]*)lor v1</div>
- <div class="lineNone">000192| )</div>
- <div class="lineNone">000193| </div>
- <div class="lineNone">000194| (* Check a value is in range 0 .. 2^bits-1. *)</div>
- <div class="lineNone">000195| let range_unsigned v bits =</div>
- <div class="lineAllVisited">000196| (*[2]*)let mask = lnot (mask bits) in</div>
- <div class="lineAllVisited">000197| (v (*[2]*)land mask) = zero</div>
- <div class="lineNone">000198| </div>
- <div class="lineNone">000199| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000200| * (big endian - so start at top).</div>
- <div class="lineNone">000201| *)</div>
- <div class="lineNone">000202| let rec map_bytes_be g f v bits =</div>
- <div class="lineAllVisited">000203| (*[6]*)if bits >= 8 then (</div>
- <div class="lineAllVisited">000204| (*[4]*)map_bytes_be g f (v >>> 8) (*[4]*)(bits-8);</div>
- <div class="lineAllVisited">000205| (*[4]*)let lsb = v land ff in</div>
- <div class="lineAllVisited">000206| (*[4]*)f (to_int lsb)</div>
- <div class="lineAllVisited">000207| ) else (*[2]*)if bits > 0 then (</div>
- <div class="lineAllUnvisited">000208| (*[0]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllUnvisited">000209| (*[0]*)g (to_int lsb) bits</div>
- <div class="lineNone">000210| )</div>
- <div class="lineNone">000211| </div>
- <div class="lineNone">000212| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000213| * (little endian - so start at root).</div>
- <div class="lineNone">000214| *)</div>
- <div class="lineNone">000215| let rec map_bytes_le g f v bits =</div>
- <div class="lineAllUnvisited">000216| (*[0]*)if bits >= 8 then (</div>
- <div class="lineAllUnvisited">000217| (*[0]*)let lsb = v land ff in</div>
- <div class="lineAllUnvisited">000218| (*[0]*)f (*[0]*)(to_int lsb);</div>
- <div class="lineAllUnvisited">000219| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
- <div class="lineAllUnvisited">000220| ) else (*[0]*)if bits > 0 then (</div>
- <div class="lineAllUnvisited">000221| (*[0]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllUnvisited">000222| (*[0]*)g (to_int lsb) bits</div>
- <div class="lineNone">000223| )</div>
- <div class="lineNone">000224| end</div>
- <div class="lineNone">000225| </div>
- <div class="lineNone">000226| module I32 = struct</div>
- <div class="lineNone">000227| (* Bitwise operations on int32s. Note we try to keep it as similar</div>
- <div class="lineNone">000228| * as possible to the I module above, to make it easier to track</div>
- <div class="lineNone">000229| * down bugs.</div>
- <div class="lineNone">000230| *)</div>
- <div class="lineAllVisited">000231| let (<<<) = (*[28]*)Int32.shift_left</div>
- <div class="lineAllVisited">000232| let (>>>) = (*[28]*)Int32.shift_right_logical</div>
- <div class="lineAllVisited">000233| let (land) = (*[28]*)Int32.logand</div>
- <div class="lineAllVisited">000234| let (lor) = (*[28]*)Int32.logor</div>
- <div class="lineAllVisited">000235| let lnot = (*[28]*)Int32.lognot</div>
- <div class="lineAllVisited">000236| let pred = (*[28]*)Int32.pred</div>
- <div class="lineAllVisited">000237| let max_int = (*[28]*)Int32.max_int</div>
- <div class="lineAllVisited">000238| let to_int = (*[28]*)Int32.to_int</div>
- <div class="lineAllVisited">000239| let zero = (*[28]*)Int32.zero</div>
- <div class="lineAllVisited">000240| let one = (*[28]*)Int32.one</div>
- <div class="lineAllVisited">000241| let minus_one = (*[28]*)Int32.minus_one</div>
- <div class="lineAllVisited">000242| let ff = (*[28]*)0xff_l</div>
- <div class="lineNone">000243| </div>
- <div class="lineNone">000244| (* Create a mask so many bits wide. *)</div>
- <div class="lineNone">000245| let mask bits =</div>
- <div class="lineAllVisited">000246| (*[12]*)if bits < 31 then</div>
- <div class="lineAllVisited">000247| (*[12]*)pred (one <<< bits)</div>
- <div class="lineAllUnvisited">000248| else (*[0]*)if bits = 31 then</div>
- <div class="lineAllUnvisited">000249| (*[0]*)max_int</div>
- <div class="lineAllUnvisited">000250| else (*[0]*)if bits = 32 then</div>
- <div class="lineAllUnvisited">000251| (*[0]*)minus_one</div>
- <div class="lineNone">000252| else</div>
- <div class="lineAllUnvisited">000253| (*[0]*)invalid_arg "Bitstring.I32.mask"</div>
- <div class="lineNone">000254| </div>
- <div class="lineNone">000255| (* Byte swap an int of a given size. *)</div>
- <div class="lineNone">000256| let byteswap v bits =</div>
- <div class="lineMixed">000257| (*[12]*)if bits <= 8 then (*[0]*)v</div>
- <div class="lineAllVisited">000258| else (*[12]*)if bits <= 16 then (</div>
- <div class="lineAllUnvisited">000259| (*[0]*)let shift = bits-8 in</div>
- <div class="lineAllUnvisited">000260| (*[0]*)let v1 = v >>> shift in</div>
- <div class="lineAllUnvisited">000261| (*[0]*)let v2 = (v land (mask shift)) <<< 8 in</div>
- <div class="lineAllUnvisited">000262| v2 (*[0]*)lor v1</div>
- <div class="lineAllVisited">000263| ) else (*[12]*)if bits <= 24 then (</div>
- <div class="lineAllUnvisited">000264| (*[0]*)let shift = bits - 16 in</div>
- <div class="lineAllUnvisited">000265| (*[0]*)let v1 = v >>> (8+shift) in</div>
- <div class="lineAllUnvisited">000266| (*[0]*)let v2 = ((v >>> shift) land ff) <<< 8 in</div>
- <div class="lineAllUnvisited">000267| (*[0]*)let v3 = (v land (mask shift)) <<< 16 in</div>
- <div class="lineAllUnvisited">000268| v3 lor v2 (*[0]*)lor v1</div>
- <div class="lineNone">000269| ) else (</div>
- <div class="lineAllVisited">000270| (*[12]*)let shift = bits - 24 in</div>
- <div class="lineAllVisited">000271| (*[12]*)let v1 = v >>> (16+shift) in</div>
- <div class="lineAllVisited">000272| (*[12]*)let v2 = ((v >>> (8+shift)) land ff) <<< 8 in</div>
- <div class="lineAllVisited">000273| (*[12]*)let v3 = ((v >>> shift) land ff) <<< 16 in</div>
- <div class="lineAllVisited">000274| (*[12]*)let v4 = (v land (mask shift)) <<< 24 in</div>
- <div class="lineAllVisited">000275| v4 lor v3 lor v2 (*[12]*)lor v1</div>
- <div class="lineNone">000276| )</div>
- <div class="lineNone">000277| </div>
- <div class="lineNone">000278| (* Check a value is in range 0 .. 2^bits-1. *)</div>
- <div class="lineNone">000279| let range_unsigned v bits =</div>
- <div class="lineAllUnvisited">000280| (*[0]*)let mask = lnot (mask bits) in</div>
- <div class="lineAllUnvisited">000281| (v (*[0]*)land mask) = zero</div>
- <div class="lineNone">000282| </div>
- <div class="lineNone">000283| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000284| * (big endian - so start at top).</div>
- <div class="lineNone">000285| *)</div>
- <div class="lineNone">000286| let rec map_bytes_be g f v bits =</div>
- <div class="lineAllUnvisited">000287| (*[0]*)if bits >= 8 then (</div>
- <div class="lineAllUnvisited">000288| (*[0]*)map_bytes_be g f (v >>> 8) (*[0]*)(bits-8);</div>
- <div class="lineAllUnvisited">000289| (*[0]*)let lsb = v land ff in</div>
- <div class="lineAllUnvisited">000290| (*[0]*)f (to_int lsb)</div>
- <div class="lineAllUnvisited">000291| ) else (*[0]*)if bits > 0 then (</div>
- <div class="lineAllUnvisited">000292| (*[0]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllUnvisited">000293| (*[0]*)g (to_int lsb) bits</div>
- <div class="lineNone">000294| )</div>
- <div class="lineNone">000295| </div>
- <div class="lineNone">000296| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000297| * (little endian - so start at root).</div>
- <div class="lineNone">000298| *)</div>
- <div class="lineNone">000299| let rec map_bytes_le g f v bits =</div>
- <div class="lineAllUnvisited">000300| (*[0]*)if bits >= 8 then (</div>
- <div class="lineAllUnvisited">000301| (*[0]*)let lsb = v land ff in</div>
- <div class="lineAllUnvisited">000302| (*[0]*)f (*[0]*)(to_int lsb);</div>
- <div class="lineAllUnvisited">000303| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
- <div class="lineAllUnvisited">000304| ) else (*[0]*)if bits > 0 then (</div>
- <div class="lineAllUnvisited">000305| (*[0]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllUnvisited">000306| (*[0]*)g (to_int lsb) bits</div>
- <div class="lineNone">000307| )</div>
- <div class="lineNone">000308| end</div>
- <div class="lineNone">000309| </div>
- <div class="lineNone">000310| module I64 = struct</div>
- <div class="lineNone">000311| (* Bitwise operations on int64s. Note we try to keep it as similar</div>
- <div class="lineNone">000312| * as possible to the I/I32 modules above, to make it easier to track</div>
- <div class="lineNone">000313| * down bugs.</div>
- <div class="lineNone">000314| *)</div>
- <div class="lineAllVisited">000315| let (<<<) = (*[28]*)Int64.shift_left</div>
- <div class="lineAllVisited">000316| let (>>>) = (*[28]*)Int64.shift_right_logical</div>
- <div class="lineAllVisited">000317| let (land) = (*[28]*)Int64.logand</div>
- <div class="lineAllVisited">000318| let (lor) = (*[28]*)Int64.logor</div>
- <div class="lineAllVisited">000319| let lnot = (*[28]*)Int64.lognot</div>
- <div class="lineAllVisited">000320| let pred = (*[28]*)Int64.pred</div>
- <div class="lineAllVisited">000321| let max_int = (*[28]*)Int64.max_int</div>
- <div class="lineAllVisited">000322| let to_int = (*[28]*)Int64.to_int</div>
- <div class="lineAllVisited">000323| let zero = (*[28]*)Int64.zero</div>
- <div class="lineAllVisited">000324| let one = (*[28]*)Int64.one</div>
- <div class="lineAllVisited">000325| let minus_one = (*[28]*)Int64.minus_one</div>
- <div class="lineAllVisited">000326| let ff = (*[28]*)0xff_L</div>
- <div class="lineNone">000327| </div>
- <div class="lineNone">000328| (* Create a mask so many bits wide. *)</div>
- <div class="lineNone">000329| let mask bits =</div>
- <div class="lineAllVisited">000330| (*[669050]*)if bits < 63 then</div>
- <div class="lineAllVisited">000331| (*[664100]*)pred (one <<< bits)</div>
- <div class="lineAllVisited">000332| else (*[4950]*)if bits = 63 then</div>
- <div class="lineAllVisited">000333| (*[4950]*)max_int</div>
- <div class="lineAllUnvisited">000334| else (*[0]*)if bits = 64 then</div>
- <div class="lineAllUnvisited">000335| (*[0]*)minus_one</div>
- <div class="lineNone">000336| else</div>
- <div class="lineAllUnvisited">000337| (*[0]*)invalid_arg "Bitstring.I64.mask"</div>
- <div class="lineNone">000338| </div>
- <div class="lineNone">000339| (* Byte swap an int of a given size. *)</div>
- <div class="lineNone">000340| (* let byteswap v bits = *)</div>
- <div class="lineNone">000341| </div>
- <div class="lineNone">000342| (* Check a value is in range 0 .. 2^bits-1. *)</div>
- <div class="lineNone">000343| let range_unsigned v bits =</div>
- <div class="lineAllVisited">000344| (*[351850]*)let mask = lnot (mask bits) in</div>
- <div class="lineAllVisited">000345| (v (*[351850]*)land mask) = zero</div>
- <div class="lineNone">000346| </div>
- <div class="lineNone">000347| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000348| * (big endian - so start at top).</div>
- <div class="lineNone">000349| *)</div>
- <div class="lineNone">000350| let rec map_bytes_be g f v bits =</div>
- <div class="lineAllVisited">000351| (*[1460650]*)if bits >= 8 then (</div>
- <div class="lineAllVisited">000352| (*[1108800]*)map_bytes_be g f (v >>> 8) (*[1108800]*)(bits-8);</div>
- <div class="lineAllVisited">000353| (*[1108800]*)let lsb = v land ff in</div>
- <div class="lineAllVisited">000354| (*[1108800]*)f (to_int lsb)</div>
- <div class="lineAllVisited">000355| ) else (*[34650]*)if bits > 0 then (</div>
- <div class="lineAllVisited">000356| (*[317200]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllVisited">000357| (*[317200]*)g (to_int lsb) bits</div>
- <div class="lineNone">000358| )</div>
- <div class="lineNone">000359| </div>
- <div class="lineNone">000360| (* Call function g on the top bits, then f on each full byte</div>
- <div class="lineNone">000361| * (little endian - so start at root).</div>
- <div class="lineNone">000362| *)</div>
- <div class="lineNone">000363| let rec map_bytes_le g f v bits =</div>
- <div class="lineAllUnvisited">000364| (*[0]*)if bits >= 8 then (</div>
- <div class="lineAllUnvisited">000365| (*[0]*)let lsb = v land ff in</div>
- <div class="lineAllUnvisited">000366| (*[0]*)f (*[0]*)(to_int lsb);</div>
- <div class="lineAllUnvisited">000367| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
- <div class="lineAllUnvisited">000368| ) else (*[0]*)if bits > 0 then (</div>
- <div class="lineAllUnvisited">000369| (*[0]*)let lsb = v land (mask bits) in</div>
- <div class="lineAllUnvisited">000370| (*[0]*)g (to_int lsb) bits</div>
- <div class="lineNone">000371| )</div>
- <div class="lineNone">000372| end</div>
- <div class="lineNone">000373| </div>
- <div class="lineNone">000374| (*----------------------------------------------------------------------*)</div>
- <div class="lineNone">000375| (* Extraction functions.</div>
- <div class="lineNone">000376| *</div>
- <div class="lineNone">000377| * NB: internal functions, called from the generated macros, and</div>
- <div class="lineNone">000378| * the parameters should have been checked for sanity already).</div>
- <div class="lineNone">000379| *)</div>
- <div class="lineNone">000380| </div>
- <div class="lineNone">000381| (* Extract and convert to numeric. A single bit is returned as</div>
- <div class="lineNone">000382| * a boolean. There are no endianness or signedness considerations.</div>
- <div class="lineNone">000383| *)</div>
- <div class="lineNone">000384| let extract_bit data off len _ = (* final param is always 1 *)</div>
- <div class="lineAllVisited">000385| (*[2515152]*)let byteoff = off lsr 3 in</div>
- <div class="lineAllVisited">000386| (*[2515152]*)let bitmask = 1 lsl (7 - (off land 7)) in</div>
- <div class="lineAllVisited">000387| (*[2515152]*)let b = Char.code data.[byteoff] land bitmask <> 0 in</div>
- <div class="lineAllVisited">000388| (*[2515152]*)b (*, off+1, len-1*)</div>
- <div class="lineNone">000389| </div>
- <div class="lineNone">000390| (* Returns 8 bit unsigned aligned bytes from the string.</div>
- <div class="lineNone">000391| * If the string ends then this returns 0's.</div>
- <div class="lineNone">000392| *)</div>
- <div class="lineNone">000393| let _get_byte data byteoff strlen =</div>
- <div class="lineAllVisited">000394| (*[9813846]*)if strlen > byteoff then (*[9247619]*)Char.code data.[byteoff] else (*[566227]*)0</div>
- <div class="lineNone">000395| let _get_byte32 data byteoff strlen =</div>
- <div class="lineMixed">000396| (*[72]*)if strlen > byteoff then (*[72]*)Int32.of_int (Char.code data.[byteoff]) else (*[0]*)0l</div>
- <div class="lineNone">000397| let _get_byte64 data byteoff strlen =</div>
- <div class="lineAllVisited">000398| (*[1626200]*)if strlen > byteoff then (*[1517793]*)Int64.of_int (Char.code data.[byteoff]) else (*[108407]*)0L</div>
- <div class="lineNone">000399| </div>
- <div class="lineNone">000400| (* Extract [2..8] bits. Because the result fits into a single</div>
- <div class="lineNone">000401| * byte we don't have to worry about endianness, only signedness.</div>
- <div class="lineNone">000402| *)</div>
- <div class="lineNone">000403| let extract_char_unsigned data off len flen =</div>
- <div class="lineAllVisited">000404| (*[5009970]*)let byteoff = off lsr 3 in</div>
- <div class="lineNone">000405| </div>
- <div class="lineNone">000406| (* Optimize the common (byte-aligned) case. *)</div>
- <div class="lineAllVisited">000407| (*[5009970]*)if off land 7 = 0 then (</div>
- <div class="lineAllVisited">000408| (*[103047]*)let byte = Char.code data.[byteoff] in</div>
- <div class="lineAllVisited">000409| byte (*[103047]*)lsr (8 - flen) (*, off+flen, len-flen*)</div>
- <div class="lineNone">000410| ) else (</div>
- <div class="lineNone">000411| (* Extract the 16 bits at byteoff and byteoff+1 (note that the</div>
- <div class="lineNone">000412| * second byte might not exist in the original string).</div>
- <div class="lineNone">000413| *)</div>
- <div class="lineAllVisited">000414| (*[4906923]*)let strlen = String.length data in</div>
- <div class="lineNone">000415| </div>
- <div class="lineAllVisited">000416| (*[4906923]*)let word =</div>
- <div class="lineNone">000417| (_get_byte data byteoff strlen lsl 8) +</div>
- <div class="lineNone">000418| _get_byte data (byteoff+1) strlen in</div>
- <div class="lineNone">000419| </div>
- <div class="lineNone">000420| (* Mask off the top bits. *)</div>
- <div class="lineAllVisited">000421| (*[4906923]*)let bitmask = (1 lsl (16 - (off land 7))) - 1 in</div>
- <div class="lineAllVisited">000422| (*[4906923]*)let word = word land bitmask in</div>
- <div class="lineNone">000423| (* Shift right to get rid of the bottom bits. *)</div>
- <div class="lineAllVisited">000424| (*[4906923]*)let shift = 16 - ((off land 7) + flen) in</div>
- <div class="lineAllVisited">000425| (*[4906923]*)let word = word lsr shift in</div>
- <div class="lineNone">000426| </div>
- <div class="lineAllVisited">000427| (*[4906923]*)word (*, off+flen, len-flen*)</div>
- <div class="lineNone">000428| )</div>
- <div class="lineNone">000429| </div>
- <div class="lineNone">000430| (* Extract [9..31] bits. We have to consider endianness and signedness. *)</div>
- <div class="lineNone">000431| let extract_int_be_unsigned data off len flen =</div>
- <div class="lineAllUnvisited">000432| (*[0]*)let byteoff = off lsr 3 in</div>
- <div class="lineNone">000433| </div>
- <div class="lineAllUnvisited">000434| (*[0]*)let strlen = String.length data in</div>
+ <div class="lineAllVisited">000129| let bitstring_length (_, _, len) = (*[1565296]*)len</div>
+ <div class="lineNone">000130| </div>
+ <div class="lineNone">000131| let subbitstring (data, off, len) off' len' =</div>
+ <div class="lineAllUnvisited">000132| (*[0]*)let off = off + off' in</div>
+ <div class="lineAllUnvisited">000133| (*[0]*)if len < off' + len' then (*[0]*)invalid_arg "subbitstring";</div>
+ <div class="lineAllUnvisited">000134| ((*[0]*)data, off, len')</div>
+ <div class="lineNone">000135| </div>
+ <div class="lineNone">000136| let dropbits n (data, off, len) =</div>
+ <div class="lineAllVisited">000137| (*[336643]*)let off = off + n in</div>
+ <div class="lineAllVisited">000138| (*[336643]*)let len = len - n in</div>
+ <div class="lineMixed">000139| (*[336643]*)if len < 0 then (*[0]*)invalid_arg "dropbits";</div>
+ <div class="lineAllVisited">000140| ((*[336643]*)data, off, len)</div>
+ <div class="lineNone">000141| </div>
+ <div class="lineNone">000142| let takebits n (data, off, len) =</div>
+ <div class="lineAllUnvisited">000143| (*[0]*)if len < n then (*[0]*)invalid_arg "takebits";</div>
+ <div class="lineAllUnvisited">000144| ((*[0]*)data, off, n)</div>
+ <div class="lineNone">000145| </div>
+ <div class="lineNone">000146| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">000147| (* Bitwise functions.</div>
+ <div class="lineNone">000148| *</div>
+ <div class="lineNone">000149| * We try to isolate all bitwise functions within these modules.</div>
+ <div class="lineNone">000150| *)</div>
+ <div class="lineNone">000151| </div>
+ <div class="lineNone">000152| module I = struct</div>
+ <div class="lineNone">000153| (* Bitwise operations on ints. Note that we assume int <= 31 bits. *)</div>
+ <div class="lineNone">000154| external (<<<) : int -> int -> int = "%lslint"</div>
+ <div class="lineNone">000155| external (>>>) : int -> int -> int = "%lsrint"</div>
+ <div class="lineNone">000156| external to_int : int -> int = "%identity"</div>
+ <div class="lineAllVisited">000157| let zero = (*[34]*)0</div>
+ <div class="lineAllVisited">000158| let one = (*[34]*)1</div>
+ <div class="lineAllVisited">000159| let minus_one = (*[34]*)-1</div>
+ <div class="lineAllVisited">000160| let ff = (*[34]*)0xff</div>
+ <div class="lineNone">000161| </div>
+ <div class="lineNone">000162| (* Create a mask 0-31 bits wide. *)</div>
+ <div class="lineNone">000163| let mask bits =</div>
+ <div class="lineAllVisited">000164| (*[2]*)if bits < 30 then</div>
+ <div class="lineAllVisited">000165| ((*[2]*)one <<< bits) - 1</div>
+ <div class="lineAllUnvisited">000166| else (*[0]*)if bits = 30 then</div>
+ <div class="lineAllUnvisited">000167| (*[0]*)max_int</div>
+ <div class="lineAllUnvisited">000168| else (*[0]*)if bits = 31 then</div>
+ <div class="lineAllUnvisited">000169| (*[0]*)minus_one</div>
+ <div class="lineNone">000170| else</div>
+ <div class="lineAllUnvisited">000171| (*[0]*)invalid_arg "Bitstring.I.mask"</div>
+ <div class="lineNone">000172| </div>
+ <div class="lineNone">000173| (* Byte swap an int of a given size. *)</div>
+ <div class="lineNone">000174| let byteswap v bits =</div>
+ <div class="lineAllUnvisited">000175| (*[0]*)if bits <= 8 then (*[0]*)v</div>
+ <div class="lineAllUnvisited">000176| else (*[0]*)if bits <= 16 then (</div>
+ <div class="lineAllUnvisited">000177| (*[0]*)let shift = bits-8 in</div>
+ <div class="lineAllUnvisited">000178| (*[0]*)let v1 = v >>> shift in</div>
+ <div class="lineAllUnvisited">000179| (*[0]*)let v2 = ((v land (mask shift)) <<< 8) in</div>
+ <div class="lineAllUnvisited">000180| v2 (*[0]*)lor v1</div>
+ <div class="lineAllUnvisited">000181| ) else (*[0]*)if bits <= 24 then (</div>
+ <div class="lineAllUnvisited">000182| (*[0]*)let shift = bits - 16 in</div>
+ <div class="lineAllUnvisited">000183| (*[0]*)let v1 = v >>> (8+shift) in</div>
+ <div class="lineAllUnvisited">000184| (*[0]*)let v2 = ((v >>> shift) land ff) <<< 8 in</div>
+ <div class="lineAllUnvisited">000185| (*[0]*)let v3 = (v land (mask shift)) <<< 16 in</div>
+ <div class="lineAllUnvisited">000186| v3 lor v2 (*[0]*)lor v1</div>
+ <div class="lineNone">000187| ) else (</div>
+ <div class="lineAllUnvisited">000188| (*[0]*)let shift = bits - 24 in</div>
+ <div class="lineAllUnvisited">000189| (*[0]*)let v1 = v >>> (16+shift) in</div>
+ <div class="lineAllUnvisited">000190| (*[0]*)let v2 = ((v >>> (8+shift)) land ff) <<< 8 in</div>
+ <div class="lineAllUnvisited">000191| (*[0]*)let v3 = ((v >>> shift) land ff) <<< 16 in</div>
+ <div class="lineAllUnvisited">000192| (*[0]*)let v4 = (v land (mask shift)) <<< 24 in</div>
+ <div class="lineAllUnvisited">000193| v4 lor v3 lor v2 (*[0]*)lor v1</div>
+ <div class="lineNone">000194| )</div>
+ <div class="lineNone">000195| </div>
+ <div class="lineNone">000196| (* Check a value is in range 0 .. 2^bits-1. *)</div>
+ <div class="lineNone">000197| let range_unsigned v bits =</div>
+ <div class="lineAllVisited">000198| (*[2]*)let mask = lnot (mask bits) in</div>
+ <div class="lineAllVisited">000199| (v (*[2]*)land mask) = zero</div>
+ <div class="lineNone">000200| </div>
+ <div class="lineNone">000201| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000202| * (big endian - so start at top).</div>
+ <div class="lineNone">000203| *)</div>
+ <div class="lineNone">000204| let rec map_bytes_be g f v bits =</div>
+ <div class="lineAllVisited">000205| (*[6]*)if bits >= 8 then (</div>
+ <div class="lineAllVisited">000206| (*[4]*)map_bytes_be g f (v >>> 8) (*[4]*)(bits-8);</div>
+ <div class="lineAllVisited">000207| (*[4]*)let lsb = v land ff in</div>
+ <div class="lineAllVisited">000208| (*[4]*)f (to_int lsb)</div>
+ <div class="lineAllVisited">000209| ) else (*[2]*)if bits > 0 then (</div>
+ <div class="lineAllUnvisited">000210| (*[0]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllUnvisited">000211| (*[0]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000212| )</div>
+ <div class="lineNone">000213| </div>
+ <div class="lineNone">000214| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000215| * (little endian - so start at root).</div>
+ <div class="lineNone">000216| *)</div>
+ <div class="lineNone">000217| let rec map_bytes_le g f v bits =</div>
+ <div class="lineAllUnvisited">000218| (*[0]*)if bits >= 8 then (</div>
+ <div class="lineAllUnvisited">000219| (*[0]*)let lsb = v land ff in</div>
+ <div class="lineAllUnvisited">000220| (*[0]*)f (*[0]*)(to_int lsb);</div>
+ <div class="lineAllUnvisited">000221| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
+ <div class="lineAllUnvisited">000222| ) else (*[0]*)if bits > 0 then (</div>
+ <div class="lineAllUnvisited">000223| (*[0]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllUnvisited">000224| (*[0]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000225| )</div>
+ <div class="lineNone">000226| end</div>
+ <div class="lineNone">000227| </div>
+ <div class="lineNone">000228| module I32 = struct</div>
+ <div class="lineNone">000229| (* Bitwise operations on int32s. Note we try to keep it as similar</div>
+ <div class="lineNone">000230| * as possible to the I module above, to make it easier to track</div>
+ <div class="lineNone">000231| * down bugs.</div>
+ <div class="lineNone">000232| *)</div>
+ <div class="lineAllVisited">000233| let (<<<) = (*[34]*)Int32.shift_left</div>
+ <div class="lineAllVisited">000234| let (>>>) = (*[34]*)Int32.shift_right_logical</div>
+ <div class="lineAllVisited">000235| let (land) = (*[34]*)Int32.logand</div>
+ <div class="lineAllVisited">000236| let (lor) = (*[34]*)Int32.logor</div>
+ <div class="lineAllVisited">000237| let lnot = (*[34]*)Int32.lognot</div>
+ <div class="lineAllVisited">000238| let pred = (*[34]*)Int32.pred</div>
+ <div class="lineAllVisited">000239| let max_int = (*[34]*)Int32.max_int</div>
+ <div class="lineAllVisited">000240| let to_int = (*[34]*)Int32.to_int</div>
+ <div class="lineAllVisited">000241| let zero = (*[34]*)Int32.zero</div>
+ <div class="lineAllVisited">000242| let one = (*[34]*)Int32.one</div>
+ <div class="lineAllVisited">000243| let minus_one = (*[34]*)Int32.minus_one</div>
+ <div class="lineAllVisited">000244| let ff = (*[34]*)0xff_l</div>
+ <div class="lineNone">000245| </div>
+ <div class="lineNone">000246| (* Create a mask so many bits wide. *)</div>
+ <div class="lineNone">000247| let mask bits =</div>
+ <div class="lineAllVisited">000248| (*[12]*)if bits < 31 then</div>
+ <div class="lineAllVisited">000249| (*[12]*)pred (one <<< bits)</div>
+ <div class="lineAllUnvisited">000250| else (*[0]*)if bits = 31 then</div>
+ <div class="lineAllUnvisited">000251| (*[0]*)max_int</div>
+ <div class="lineAllUnvisited">000252| else (*[0]*)if bits = 32 then</div>
+ <div class="lineAllUnvisited">000253| (*[0]*)minus_one</div>
+ <div class="lineNone">000254| else</div>
+ <div class="lineAllUnvisited">000255| (*[0]*)invalid_arg "Bitstring.I32.mask"</div>
+ <div class="lineNone">000256| </div>
+ <div class="lineNone">000257| (* Byte swap an int of a given size. *)</div>
+ <div class="lineNone">000258| let byteswap v bits =</div>
+ <div class="lineMixed">000259| (*[12]*)if bits <= 8 then (*[0]*)v</div>
+ <div class="lineAllVisited">000260| else (*[12]*)if bits <= 16 then (</div>
+ <div class="lineAllUnvisited">000261| (*[0]*)let shift = bits-8 in</div>
+ <div class="lineAllUnvisited">000262| (*[0]*)let v1 = v >>> shift in</div>
+ <div class="lineAllUnvisited">000263| (*[0]*)let v2 = (v land (mask shift)) <<< 8 in</div>
+ <div class="lineAllUnvisited">000264| v2 (*[0]*)lor v1</div>
+ <div class="lineAllVisited">000265| ) else (*[12]*)if bits <= 24 then (</div>
+ <div class="lineAllUnvisited">000266| (*[0]*)let shift = bits - 16 in</div>
+ <div class="lineAllUnvisited">000267| (*[0]*)let v1 = v >>> (8+shift) in</div>
+ <div class="lineAllUnvisited">000268| (*[0]*)let v2 = ((v >>> shift) land ff) <<< 8 in</div>
+ <div class="lineAllUnvisited">000269| (*[0]*)let v3 = (v land (mask shift)) <<< 16 in</div>
+ <div class="lineAllUnvisited">000270| v3 lor v2 (*[0]*)lor v1</div>
+ <div class="lineNone">000271| ) else (</div>
+ <div class="lineAllVisited">000272| (*[12]*)let shift = bits - 24 in</div>
+ <div class="lineAllVisited">000273| (*[12]*)let v1 = v >>> (16+shift) in</div>
+ <div class="lineAllVisited">000274| (*[12]*)let v2 = ((v >>> (8+shift)) land ff) <<< 8 in</div>
+ <div class="lineAllVisited">000275| (*[12]*)let v3 = ((v >>> shift) land ff) <<< 16 in</div>
+ <div class="lineAllVisited">000276| (*[12]*)let v4 = (v land (mask shift)) <<< 24 in</div>
+ <div class="lineAllVisited">000277| v4 lor v3 lor v2 (*[12]*)lor v1</div>
+ <div class="lineNone">000278| )</div>
+ <div class="lineNone">000279| </div>
+ <div class="lineNone">000280| (* Check a value is in range 0 .. 2^bits-1. *)</div>
+ <div class="lineNone">000281| let range_unsigned v bits =</div>
+ <div class="lineAllUnvisited">000282| (*[0]*)let mask = lnot (mask bits) in</div>
+ <div class="lineAllUnvisited">000283| (v (*[0]*)land mask) = zero</div>
+ <div class="lineNone">000284| </div>
+ <div class="lineNone">000285| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000286| * (big endian - so start at top).</div>
+ <div class="lineNone">000287| *)</div>
+ <div class="lineNone">000288| let rec map_bytes_be g f v bits =</div>
+ <div class="lineAllUnvisited">000289| (*[0]*)if bits >= 8 then (</div>
+ <div class="lineAllUnvisited">000290| (*[0]*)map_bytes_be g f (v >>> 8) (*[0]*)(bits-8);</div>
+ <div class="lineAllUnvisited">000291| (*[0]*)let lsb = v land ff in</div>
+ <div class="lineAllUnvisited">000292| (*[0]*)f (to_int lsb)</div>
+ <div class="lineAllUnvisited">000293| ) else (*[0]*)if bits > 0 then (</div>
+ <div class="lineAllUnvisited">000294| (*[0]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllUnvisited">000295| (*[0]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000296| )</div>
+ <div class="lineNone">000297| </div>
+ <div class="lineNone">000298| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000299| * (little endian - so start at root).</div>
+ <div class="lineNone">000300| *)</div>
+ <div class="lineNone">000301| let rec map_bytes_le g f v bits =</div>
+ <div class="lineAllUnvisited">000302| (*[0]*)if bits >= 8 then (</div>
+ <div class="lineAllUnvisited">000303| (*[0]*)let lsb = v land ff in</div>
+ <div class="lineAllUnvisited">000304| (*[0]*)f (*[0]*)(to_int lsb);</div>
+ <div class="lineAllUnvisited">000305| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
+ <div class="lineAllUnvisited">000306| ) else (*[0]*)if bits > 0 then (</div>
+ <div class="lineAllUnvisited">000307| (*[0]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllUnvisited">000308| (*[0]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000309| )</div>
+ <div class="lineNone">000310| end</div>
+ <div class="lineNone">000311| </div>
+ <div class="lineNone">000312| module I64 = struct</div>
+ <div class="lineNone">000313| (* Bitwise operations on int64s. Note we try to keep it as similar</div>
+ <div class="lineNone">000314| * as possible to the I/I32 modules above, to make it easier to track</div>
+ <div class="lineNone">000315| * down bugs.</div>
+ <div class="lineNone">000316| *)</div>
+ <div class="lineAllVisited">000317| let (<<<) = (*[34]*)Int64.shift_left</div>
+ <div class="lineAllVisited">000318| let (>>>) = (*[34]*)Int64.shift_right_logical</div>
+ <div class="lineAllVisited">000319| let (land) = (*[34]*)Int64.logand</div>
+ <div class="lineAllVisited">000320| let (lor) = (*[34]*)Int64.logor</div>
+ <div class="lineAllVisited">000321| let lnot = (*[34]*)Int64.lognot</div>
+ <div class="lineAllVisited">000322| let pred = (*[34]*)Int64.pred</div>
+ <div class="lineAllVisited">000323| let max_int = (*[34]*)Int64.max_int</div>
+ <div class="lineAllVisited">000324| let to_int = (*[34]*)Int64.to_int</div>
+ <div class="lineAllVisited">000325| let zero = (*[34]*)Int64.zero</div>
+ <div class="lineAllVisited">000326| let one = (*[34]*)Int64.one</div>
+ <div class="lineAllVisited">000327| let minus_one = (*[34]*)Int64.minus_one</div>
+ <div class="lineAllVisited">000328| let ff = (*[34]*)0xff_L</div>
+ <div class="lineNone">000329| </div>
+ <div class="lineNone">000330| (* Create a mask so many bits wide. *)</div>
+ <div class="lineNone">000331| let mask bits =</div>
+ <div class="lineAllVisited">000332| (*[669050]*)if bits < 63 then</div>
+ <div class="lineAllVisited">000333| (*[664100]*)pred (one <<< bits)</div>
+ <div class="lineAllVisited">000334| else (*[4950]*)if bits = 63 then</div>
+ <div class="lineAllVisited">000335| (*[4950]*)max_int</div>
+ <div class="lineAllUnvisited">000336| else (*[0]*)if bits = 64 then</div>
+ <div class="lineAllUnvisited">000337| (*[0]*)minus_one</div>
+ <div class="lineNone">000338| else</div>
+ <div class="lineAllUnvisited">000339| (*[0]*)invalid_arg "Bitstring.I64.mask"</div>
+ <div class="lineNone">000340| </div>
+ <div class="lineNone">000341| (* Byte swap an int of a given size. *)</div>
+ <div class="lineNone">000342| (* let byteswap v bits = *)</div>
+ <div class="lineNone">000343| </div>
+ <div class="lineNone">000344| (* Check a value is in range 0 .. 2^bits-1. *)</div>
+ <div class="lineNone">000345| let range_unsigned v bits =</div>
+ <div class="lineAllVisited">000346| (*[351850]*)let mask = lnot (mask bits) in</div>
+ <div class="lineAllVisited">000347| (v (*[351850]*)land mask) = zero</div>
+ <div class="lineNone">000348| </div>
+ <div class="lineNone">000349| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000350| * (big endian - so start at top).</div>
+ <div class="lineNone">000351| *)</div>
+ <div class="lineNone">000352| let rec map_bytes_be g f v bits =</div>
+ <div class="lineAllVisited">000353| (*[1460650]*)if bits >= 8 then (</div>
+ <div class="lineAllVisited">000354| (*[1108800]*)map_bytes_be g f (v >>> 8) (*[1108800]*)(bits-8);</div>
+ <div class="lineAllVisited">000355| (*[1108800]*)let lsb = v land ff in</div>
+ <div class="lineAllVisited">000356| (*[1108800]*)f (to_int lsb)</div>
+ <div class="lineAllVisited">000357| ) else (*[34650]*)if bits > 0 then (</div>
+ <div class="lineAllVisited">000358| (*[317200]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllVisited">000359| (*[317200]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000360| )</div>
+ <div class="lineNone">000361| </div>
+ <div class="lineNone">000362| (* Call function g on the top bits, then f on each full byte</div>
+ <div class="lineNone">000363| * (little endian - so start at root).</div>
+ <div class="lineNone">000364| *)</div>
+ <div class="lineNone">000365| let rec map_bytes_le g f v bits =</div>
+ <div class="lineAllUnvisited">000366| (*[0]*)if bits >= 8 then (</div>
+ <div class="lineAllUnvisited">000367| (*[0]*)let lsb = v land ff in</div>
+ <div class="lineAllUnvisited">000368| (*[0]*)f (*[0]*)(to_int lsb);</div>
+ <div class="lineAllUnvisited">000369| (*[0]*)map_bytes_le g f (v >>> 8) (bits-8)</div>
+ <div class="lineAllUnvisited">000370| ) else (*[0]*)if bits > 0 then (</div>
+ <div class="lineAllUnvisited">000371| (*[0]*)let lsb = v land (mask bits) in</div>
+ <div class="lineAllUnvisited">000372| (*[0]*)g (to_int lsb) bits</div>
+ <div class="lineNone">000373| )</div>
+ <div class="lineNone">000374| end</div>
+ <div class="lineNone">000375| </div>
+ <div class="lineNone">000376| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">000377| (* Extraction functions.</div>
+ <div class="lineNone">000378| *</div>
+ <div class="lineNone">000379| * NB: internal functions, called from the generated macros, and</div>
+ <div class="lineNone">000380| * the parameters should have been checked for sanity already).</div>
+ <div class="lineNone">000381| *)</div>
+ <div class="lineNone">000382| </div>
+ <div class="lineNone">000383| (* Extract and convert to numeric. A single bit is returned as</div>
+ <div class="lineNone">000384| * a boolean. There are no endianness or signedness considerations.</div>
+ <div class="lineNone">000385| *)</div>
+ <div class="lineNone">000386| let extract_bit data off len _ = (* final param is always 1 *)</div>
+ <div class="lineAllVisited">000387| (*[2515152]*)let byteoff = off lsr 3 in</div>
+ <div class="lineAllVisited">000388| (*[2515152]*)let bitmask = 1 lsl (7 - (off land 7)) in</div>
+ <div class="lineAllVisited">000389| (*[2515152]*)let b = Char.code data.[byteoff] land bitmask <> 0 in</div>
+ <div class="lineAllVisited">000390| (*[2515152]*)b (*, off+1, len-1*)</div>
+ <div class="lineNone">000391| </div>
+ <div class="lineNone">000392| (* Returns 8 bit unsigned aligned bytes from the string.</div>
+ <div class="lineNone">000393| * If the string ends then this returns 0's.</div>
+ <div class="lineNone">000394| *)</div>
+ <div class="lineNone">000395| let _get_byte data byteoff strlen =</div>
+ <div class="lineAllVisited">000396| (*[9818264]*)if strlen > byteoff then (*[9252298]*)Char.code data.[byteoff] else (*[565966]*)0</div>
+ <div class="lineNone">000397| let _get_byte32 data byteoff strlen =</div>
+ <div class="lineMixed">000398| (*[72]*)if strlen > byteoff then (*[72]*)Int32.of_int (Char.code data.[byteoff]) else (*[0]*)0l</div>
+ <div class="lineNone">000399| let _get_byte64 data byteoff strlen =</div>
+ <div class="lineAllVisited">000400| (*[1626456]*)if strlen > byteoff then (*[1517847]*)Int64.of_int (Char.code data.[byteoff]) else (*[108609]*)0L</div>
+ <div class="lineNone">000401| </div>
+ <div class="lineNone">000402| (* Extract [2..8] bits. Because the result fits into a single</div>
+ <div class="lineNone">000403| * byte we don't have to worry about endianness, only signedness.</div>
+ <div class="lineNone">000404| *)</div>
+ <div class="lineNone">000405| let extract_char_unsigned data off len flen =</div>
+ <div class="lineAllVisited">000406| (*[5030404]*)let byteoff = off lsr 3 in</div>
+ <div class="lineNone">000407| </div>
+ <div class="lineNone">000408| (* Optimize the common (byte-aligned) case. *)</div>
+ <div class="lineAllVisited">000409| (*[5030404]*)if off land 7 = 0 then (</div>
+ <div class="lineAllVisited">000410| (*[121272]*)let byte = Char.code data.[byteoff] in</div>
+ <div class="lineAllVisited">000411| byte (*[121272]*)lsr (8 - flen) (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000412| ) else (</div>
+ <div class="lineNone">000413| (* Extract the 16 bits at byteoff and byteoff+1 (note that the</div>
+ <div class="lineNone">000414| * second byte might not exist in the original string).</div>
+ <div class="lineNone">000415| *)</div>
+ <div class="lineAllVisited">000416| (*[4909132]*)let strlen = String.length data in</div>
+ <div class="lineNone">000417| </div>
+ <div class="lineAllVisited">000418| (*[4909132]*)let word =</div>
+ <div class="lineNone">000419| (_get_byte data byteoff strlen lsl 8) +</div>
+ <div class="lineNone">000420| _get_byte data (byteoff+1) strlen in</div>
+ <div class="lineNone">000421| </div>
+ <div class="lineNone">000422| (* Mask off the top bits. *)</div>
+ <div class="lineAllVisited">000423| (*[4909132]*)let bitmask = (1 lsl (16 - (off land 7))) - 1 in</div>
+ <div class="lineAllVisited">000424| (*[4909132]*)let word = word land bitmask in</div>
+ <div class="lineNone">000425| (* Shift right to get rid of the bottom bits. *)</div>
+ <div class="lineAllVisited">000426| (*[4909132]*)let shift = 16 - ((off land 7) + flen) in</div>
+ <div class="lineAllVisited">000427| (*[4909132]*)let word = word lsr shift in</div>
+ <div class="lineNone">000428| </div>
+ <div class="lineAllVisited">000429| (*[4909132]*)word (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000430| )</div>
+ <div class="lineNone">000431| </div>
+ <div class="lineNone">000432| (* Extract [9..31] bits. We have to consider endianness and signedness. *)</div>
+ <div class="lineNone">000433| let extract_int_be_unsigned data off len flen =</div>
+ <div class="lineAllUnvisited">000434| (*[0]*)let byteoff = off lsr 3 in</div>
<div class="lineNone">000435| </div>
- <div class="lineAllUnvisited">000436| (*[0]*)let word =</div>
- <div class="lineNone">000437| (* Optimize the common (byte-aligned) case. *)</div>
- <div class="lineNone">000438| if off land 7 = 0 then (</div>
- <div class="lineAllUnvisited">000439| (*[0]*)let word =</div>
- <div class="lineNone">000440| (_get_byte data byteoff strlen lsl 23) +</div>
- <div class="lineNone">000441| (_get_byte data (byteoff+1) strlen lsl 15) +</div>
- <div class="lineNone">000442| (_get_byte data (byteoff+2) strlen lsl 7) +</div>
- <div class="lineNone">000443| (_get_byte data (byteoff+3) strlen lsr 1) in</div>
- <div class="lineAllUnvisited">000444| word (*[0]*)lsr (31 - flen)</div>
- <div class="lineAllUnvisited">000445| ) else (*[0]*)if flen <= 24 then (</div>
- <div class="lineNone">000446| (* Extract the 31 bits at byteoff .. byteoff+3. *)</div>
- <div class="lineAllUnvisited">000447| (*[0]*)let word =</div>
- <div class="lineNone">000448| (_get_byte data byteoff strlen lsl 23) +</div>
- <div class="lineNone">000449| (_get_byte data (byteoff+1) strlen lsl 15) +</div>
- <div class="lineNone">000450| (_get_byte data (byteoff+2) strlen lsl 7) +</div>
- <div class="lineNone">000451| (_get_byte data (byteoff+3) strlen lsr 1) in</div>
- <div class="lineNone">000452| (* Mask off the top bits. *)</div>
- <div class="lineAllUnvisited">000453| (*[0]*)let bitmask = (1 lsl (31 - (off land 7))) - 1 in</div>
- <div class="lineAllUnvisited">000454| (*[0]*)let word = word land bitmask in</div>
- <div class="lineNone">000455| (* Shift right to get rid of the bottom bits. *)</div>
- <div class="lineAllUnvisited">000456| (*[0]*)let shift = 31 - ((off land 7) + flen) in</div>
- <div class="lineAllUnvisited">000457| word (*[0]*)lsr shift</div>
- <div class="lineNone">000458| ) else (</div>
- <div class="lineNone">000459| (* Extract the next 31 bits, slow method. *)</div>
- <div class="lineAllUnvisited">000460| (*[0]*)let word =</div>
- <div class="lineNone">000461| let c0 = extract_char_unsigned data off len 8</div>
- <div class="lineNone">000462| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000463| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000436| (*[0]*)let strlen = String.length data in</div>
+ <div class="lineNone">000437| </div>
+ <div class="lineAllUnvisited">000438| (*[0]*)let word =</div>
+ <div class="lineNone">000439| (* Optimize the common (byte-aligned) case. *)</div>
+ <div class="lineNone">000440| if off land 7 = 0 then (</div>
+ <div class="lineAllUnvisited">000441| (*[0]*)let word =</div>
+ <div class="lineNone">000442| (_get_byte data byteoff strlen lsl 23) +</div>
+ <div class="lineNone">000443| (_get_byte data (byteoff+1) strlen lsl 15) +</div>
+ <div class="lineNone">000444| (_get_byte data (byteoff+2) strlen lsl 7) +</div>
+ <div class="lineNone">000445| (_get_byte data (byteoff+3) strlen lsr 1) in</div>
+ <div class="lineAllUnvisited">000446| word (*[0]*)lsr (31 - flen)</div>
+ <div class="lineAllUnvisited">000447| ) else (*[0]*)if flen <= 24 then (</div>
+ <div class="lineNone">000448| (* Extract the 31 bits at byteoff .. byteoff+3. *)</div>
+ <div class="lineAllUnvisited">000449| (*[0]*)let word =</div>
+ <div class="lineNone">000450| (_get_byte data byteoff strlen lsl 23) +</div>
+ <div class="lineNone">000451| (_get_byte data (byteoff+1) strlen lsl 15) +</div>
+ <div class="lineNone">000452| (_get_byte data (byteoff+2) strlen lsl 7) +</div>
+ <div class="lineNone">000453| (_get_byte data (byteoff+3) strlen lsr 1) in</div>
+ <div class="lineNone">000454| (* Mask off the top bits. *)</div>
+ <div class="lineAllUnvisited">000455| (*[0]*)let bitmask = (1 lsl (31 - (off land 7))) - 1 in</div>
+ <div class="lineAllUnvisited">000456| (*[0]*)let word = word land bitmask in</div>
+ <div class="lineNone">000457| (* Shift right to get rid of the bottom bits. *)</div>
+ <div class="lineAllUnvisited">000458| (*[0]*)let shift = 31 - ((off land 7) + flen) in</div>
+ <div class="lineAllUnvisited">000459| word (*[0]*)lsr shift</div>
+ <div class="lineNone">000460| ) else (</div>
+ <div class="lineNone">000461| (* Extract the next 31 bits, slow method. *)</div>
+ <div class="lineAllUnvisited">000462| (*[0]*)let word =</div>
+ <div class="lineNone">000463| let c0 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000464| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000465| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000465| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000466| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000467| (*[0]*)let c3 = extract_char_unsigned data off len 7 in</div>
- <div class="lineAllUnvisited">000468| (c0 (*[0]*)lsl 23) + (c1 lsl 15) + (c2 lsl 7) + c3 in</div>
- <div class="lineAllUnvisited">000469| word (*[0]*)lsr (31 - flen)</div>
- <div class="lineNone">000470| ) in</div>
- <div class="lineAllUnvisited">000471| (*[0]*)word (*, off+flen, len-flen*)</div>
- <div class="lineNone">000472| </div>
- <div class="lineNone">000473| let extract_int_le_unsigned data off len flen =</div>
- <div class="lineAllUnvisited">000474| (*[0]*)let v = extract_int_be_unsigned data off len flen in</div>
- <div class="lineAllUnvisited">000475| (*[0]*)let v = I.byteswap v flen in</div>
- <div class="lineAllUnvisited">000476| (*[0]*)v</div>
- <div class="lineNone">000477| </div>
- <div class="lineNone">000478| let extract_int_ne_unsigned =</div>
- <div class="lineAllVisited">000479| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000480| then (*[0]*)extract_int_be_unsigned</div>
- <div class="lineAllVisited">000481| else (*[28]*)extract_int_le_unsigned</div>
- <div class="lineNone">000482| </div>
- <div class="lineNone">000483| let extract_int_ee_unsigned = function</div>
- <div class="lineAllUnvisited">000484| | BigEndian -> (*[0]*)extract_int_be_unsigned</div>
- <div class="lineAllUnvisited">000485| | LittleEndian -> (*[0]*)extract_int_le_unsigned</div>
- <div class="lineAllUnvisited">000486| | NativeEndian -> (*[0]*)extract_int_ne_unsigned</div>
- <div class="lineNone">000487| </div>
- <div class="lineNone">000488| let _make_int32_be c0 c1 c2 c3 =</div>
- <div class="lineAllVisited">000489| (*[18]*)Int32.logor</div>
- <div class="lineNone">000490| (Int32.logor</div>
- <div class="lineNone">000491| (Int32.logor</div>
- <div class="lineNone">000492| (Int32.shift_left c0 24)</div>
- <div class="lineNone">000493| (Int32.shift_left c1 16))</div>
- <div class="lineNone">000494| (Int32.shift_left c2 8))</div>
- <div class="lineNone">000495| c3</div>
- <div class="lineNone">000496| </div>
- <div class="lineNone">000497| let _make_int32_le c0 c1 c2 c3 =</div>
- <div class="lineAllUnvisited">000498| (*[0]*)Int32.logor</div>
- <div class="lineNone">000499| (Int32.logor</div>
- <div class="lineNone">000500| (Int32.logor</div>
- <div class="lineNone">000501| (Int32.shift_left c3 24)</div>
- <div class="lineNone">000502| (Int32.shift_left c2 16))</div>
- <div class="lineNone">000503| (Int32.shift_left c1 8))</div>
- <div class="lineNone">000504| c0</div>
- <div class="lineNone">000505| </div>
- <div class="lineNone">000506| (* Extract exactly 32 bits. We have to consider endianness and signedness. *)</div>
- <div class="lineNone">000507| let extract_int32_be_unsigned data off len flen =</div>
- <div class="lineAllVisited">000508| (*[18]*)let byteoff = off lsr 3 in</div>
- <div class="lineNone">000509| </div>
- <div class="lineAllVisited">000510| (*[18]*)let strlen = String.length data in</div>
+ <div class="lineAllUnvisited">000467| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineNone">000468| and off = off + 8 and len = len - 8 in</div>
+ <div class="lineAllUnvisited">000469| (*[0]*)let c3 = extract_char_unsigned data off len 7 in</div>
+ <div class="lineAllUnvisited">000470| (c0 (*[0]*)lsl 23) + (c1 lsl 15) + (c2 lsl 7) + c3 in</div>
+ <div class="lineAllUnvisited">000471| word (*[0]*)lsr (31 - flen)</div>
+ <div class="lineNone">000472| ) in</div>
+ <div class="lineAllUnvisited">000473| (*[0]*)word (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000474| </div>
+ <div class="lineNone">000475| let extract_int_le_unsigned data off len flen =</div>
+ <div class="lineAllUnvisited">000476| (*[0]*)let v = extract_int_be_unsigned data off len flen in</div>
+ <div class="lineAllUnvisited">000477| (*[0]*)let v = I.byteswap v flen in</div>
+ <div class="lineAllUnvisited">000478| (*[0]*)v</div>
+ <div class="lineNone">000479| </div>
+ <div class="lineNone">000480| let extract_int_ne_unsigned =</div>
+ <div class="lineAllVisited">000481| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000482| then (*[0]*)extract_int_be_unsigned</div>
+ <div class="lineAllVisited">000483| else (*[34]*)extract_int_le_unsigned</div>
+ <div class="lineNone">000484| </div>
+ <div class="lineNone">000485| let extract_int_ee_unsigned = function</div>
+ <div class="lineAllUnvisited">000486| | BigEndian -> (*[0]*)extract_int_be_unsigned</div>
+ <div class="lineAllUnvisited">000487| | LittleEndian -> (*[0]*)extract_int_le_unsigned</div>
+ <div class="lineAllUnvisited">000488| | NativeEndian -> (*[0]*)extract_int_ne_unsigned</div>
+ <div class="lineNone">000489| </div>
+ <div class="lineNone">000490| let _make_int32_be c0 c1 c2 c3 =</div>
+ <div class="lineAllVisited">000491| (*[18]*)Int32.logor</div>
+ <div class="lineNone">000492| (Int32.logor</div>
+ <div class="lineNone">000493| (Int32.logor</div>
+ <div class="lineNone">000494| (Int32.shift_left c0 24)</div>
+ <div class="lineNone">000495| (Int32.shift_left c1 16))</div>
+ <div class="lineNone">000496| (Int32.shift_left c2 8))</div>
+ <div class="lineNone">000497| c3</div>
+ <div class="lineNone">000498| </div>
+ <div class="lineNone">000499| let _make_int32_le c0 c1 c2 c3 =</div>
+ <div class="lineAllUnvisited">000500| (*[0]*)Int32.logor</div>
+ <div class="lineNone">000501| (Int32.logor</div>
+ <div class="lineNone">000502| (Int32.logor</div>
+ <div class="lineNone">000503| (Int32.shift_left c3 24)</div>
+ <div class="lineNone">000504| (Int32.shift_left c2 16))</div>
+ <div class="lineNone">000505| (Int32.shift_left c1 8))</div>
+ <div class="lineNone">000506| c0</div>
+ <div class="lineNone">000507| </div>
+ <div class="lineNone">000508| (* Extract exactly 32 bits. We have to consider endianness and signedness. *)</div>
+ <div class="lineNone">000509| let extract_int32_be_unsigned data off len flen =</div>
+ <div class="lineAllVisited">000510| (*[18]*)let byteoff = off lsr 3 in</div>
<div class="lineNone">000511| </div>
- <div class="lineAllVisited">000512| (*[18]*)let word =</div>
- <div class="lineNone">000513| (* Optimize the common (byte-aligned) case. *)</div>
- <div class="lineNone">000514| if off land 7 = 0 then (</div>
- <div class="lineAllVisited">000515| (*[18]*)let word =</div>
- <div class="lineNone">000516| let c0 = _get_byte32 data byteoff strlen in</div>
- <div class="lineAllVisited">000517| (*[18]*)let c1 = _get_byte32 data (byteoff+1) strlen in</div>
- <div class="lineAllVisited">000518| (*[18]*)let c2 = _get_byte32 data (byteoff+2) strlen in</div>
- <div class="lineAllVisited">000519| (*[18]*)let c3 = _get_byte32 data (byteoff+3) strlen in</div>
- <div class="lineAllVisited">000520| (*[18]*)_make_int32_be c0 c1 c2 c3 in</div>
- <div class="lineAllVisited">000521| (*[18]*)Int32.shift_right_logical word (32 - flen)</div>
- <div class="lineNone">000522| ) else (</div>
- <div class="lineNone">000523| (* Extract the next 32 bits, slow method. *)</div>
- <div class="lineAllUnvisited">000524| (*[0]*)let word =</div>
- <div class="lineNone">000525| let c0 = extract_char_unsigned data off len 8</div>
- <div class="lineNone">000526| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000527| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000512| (*[18]*)let strlen = String.length data in</div>
+ <div class="lineNone">000513| </div>
+ <div class="lineAllVisited">000514| (*[18]*)let word =</div>
+ <div class="lineNone">000515| (* Optimize the common (byte-aligned) case. *)</div>
+ <div class="lineNone">000516| if off land 7 = 0 then (</div>
+ <div class="lineAllVisited">000517| (*[18]*)let word =</div>
+ <div class="lineNone">000518| let c0 = _get_byte32 data byteoff strlen in</div>
+ <div class="lineAllVisited">000519| (*[18]*)let c1 = _get_byte32 data (byteoff+1) strlen in</div>
+ <div class="lineAllVisited">000520| (*[18]*)let c2 = _get_byte32 data (byteoff+2) strlen in</div>
+ <div class="lineAllVisited">000521| (*[18]*)let c3 = _get_byte32 data (byteoff+3) strlen in</div>
+ <div class="lineAllVisited">000522| (*[18]*)_make_int32_be c0 c1 c2 c3 in</div>
+ <div class="lineAllVisited">000523| (*[18]*)Int32.shift_right_logical word (32 - flen)</div>
+ <div class="lineNone">000524| ) else (</div>
+ <div class="lineNone">000525| (* Extract the next 32 bits, slow method. *)</div>
+ <div class="lineAllUnvisited">000526| (*[0]*)let word =</div>
+ <div class="lineNone">000527| let c0 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000528| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000529| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000529| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000530| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000531| (*[0]*)let c3 = extract_char_unsigned data off len 8 in</div>
- <div class="lineAllUnvisited">000532| (*[0]*)let c0 = Int32.of_int c0 in</div>
- <div class="lineAllUnvisited">000533| (*[0]*)let c1 = Int32.of_int c1 in</div>
- <div class="lineAllUnvisited">000534| (*[0]*)let c2 = Int32.of_int c2 in</div>
- <div class="lineAllUnvisited">000535| (*[0]*)let c3 = Int32.of_int c3 in</div>
- <div class="lineAllUnvisited">000536| (*[0]*)_make_int32_be c0 c1 c2 c3 in</div>
- <div class="lineAllUnvisited">000537| (*[0]*)Int32.shift_right_logical word (32 - flen)</div>
- <div class="lineNone">000538| ) in</div>
- <div class="lineAllVisited">000539| (*[18]*)word (*, off+flen, len-flen*)</div>
- <div class="lineNone">000540| </div>
- <div class="lineNone">000541| let extract_int32_le_unsigned data off len flen =</div>
- <div class="lineAllVisited">000542| (*[12]*)let v = extract_int32_be_unsigned data off len flen in</div>
- <div class="lineAllVisited">000543| (*[12]*)let v = I32.byteswap v flen in</div>
- <div class="lineAllVisited">000544| (*[12]*)v</div>
- <div class="lineNone">000545| </div>
- <div class="lineNone">000546| let extract_int32_ne_unsigned =</div>
- <div class="lineAllVisited">000547| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000548| then (*[0]*)extract_int32_be_unsigned</div>
- <div class="lineAllVisited">000549| else (*[28]*)extract_int32_le_unsigned</div>
- <div class="lineNone">000550| </div>
- <div class="lineNone">000551| let extract_int32_ee_unsigned = function</div>
- <div class="lineAllVisited">000552| | BigEndian -> (*[6]*)extract_int32_be_unsigned</div>
- <div class="lineAllVisited">000553| | LittleEndian -> (*[6]*)extract_int32_le_unsigned</div>
- <div class="lineAllVisited">000554| | NativeEndian -> (*[6]*)extract_int32_ne_unsigned</div>
- <div class="lineNone">000555| </div>
- <div class="lineNone">000556| let _make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 =</div>
- <div class="lineAllVisited">000557| (*[657463]*)Int64.logor</div>
- <div class="lineNone">000558| (Int64.logor</div>
- <div class="lineNone">000559| (Int64.logor</div>
- <div class="lineNone">000560| (Int64.logor</div>
- <div class="lineNone">000561| (Int64.logor</div>
- <div class="lineNone">000562| (Int64.logor</div>
- <div class="lineNone">000563| (Int64.logor</div>
- <div class="lineNone">000564| (Int64.shift_left c0 56)</div>
- <div class="lineNone">000565| (Int64.shift_left c1 48))</div>
- <div class="lineNone">000566| (Int64.shift_left c2 40))</div>
- <div class="lineNone">000567| (Int64.shift_left c3 32))</div>
- <div class="lineNone">000568| (Int64.shift_left c4 24))</div>
- <div class="lineNone">000569| (Int64.shift_left c5 16))</div>
- <div class="lineNone">000570| (Int64.shift_left c6 8))</div>
- <div class="lineNone">000571| c7</div>
- <div class="lineNone">000572| </div>
- <div class="lineNone">000573| let _make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 =</div>
- <div class="lineAllUnvisited">000574| (*[0]*)_make_int64_be c7 c6 c5 c4 c3 c2 c1 c0</div>
- <div class="lineNone">000575| </div>
- <div class="lineNone">000576| (* Extract [1..64] bits. We have to consider endianness and signedness. *)</div>
- <div class="lineNone">000577| let extract_int64_be_unsigned data off len flen =</div>
- <div class="lineAllVisited">000578| (*[657463]*)let byteoff = off lsr 3 in</div>
- <div class="lineNone">000579| </div>
- <div class="lineAllVisited">000580| (*[657463]*)let strlen = String.length data in</div>
+ <div class="lineAllUnvisited">000531| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineNone">000532| and off = off + 8 and len = len - 8 in</div>
+ <div class="lineAllUnvisited">000533| (*[0]*)let c3 = extract_char_unsigned data off len 8 in</div>
+ <div class="lineAllUnvisited">000534| (*[0]*)let c0 = Int32.of_int c0 in</div>
+ <div class="lineAllUnvisited">000535| (*[0]*)let c1 = Int32.of_int c1 in</div>
+ <div class="lineAllUnvisited">000536| (*[0]*)let c2 = Int32.of_int c2 in</div>
+ <div class="lineAllUnvisited">000537| (*[0]*)let c3 = Int32.of_int c3 in</div>
+ <div class="lineAllUnvisited">000538| (*[0]*)_make_int32_be c0 c1 c2 c3 in</div>
+ <div class="lineAllUnvisited">000539| (*[0]*)Int32.shift_right_logical word (32 - flen)</div>
+ <div class="lineNone">000540| ) in</div>
+ <div class="lineAllVisited">000541| (*[18]*)word (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000542| </div>
+ <div class="lineNone">000543| let extract_int32_le_unsigned data off len flen =</div>
+ <div class="lineAllVisited">000544| (*[12]*)let v = extract_int32_be_unsigned data off len flen in</div>
+ <div class="lineAllVisited">000545| (*[12]*)let v = I32.byteswap v flen in</div>
+ <div class="lineAllVisited">000546| (*[12]*)v</div>
+ <div class="lineNone">000547| </div>
+ <div class="lineNone">000548| let extract_int32_ne_unsigned =</div>
+ <div class="lineAllVisited">000549| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000550| then (*[0]*)extract_int32_be_unsigned</div>
+ <div class="lineAllVisited">000551| else (*[34]*)extract_int32_le_unsigned</div>
+ <div class="lineNone">000552| </div>
+ <div class="lineNone">000553| let extract_int32_ee_unsigned = function</div>
+ <div class="lineAllVisited">000554| | BigEndian -> (*[6]*)extract_int32_be_unsigned</div>
+ <div class="lineAllVisited">000555| | LittleEndian -> (*[6]*)extract_int32_le_unsigned</div>
+ <div class="lineAllVisited">000556| | NativeEndian -> (*[6]*)extract_int32_ne_unsigned</div>
+ <div class="lineNone">000557| </div>
+ <div class="lineNone">000558| let _make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 =</div>
+ <div class="lineAllVisited">000559| (*[657463]*)Int64.logor</div>
+ <div class="lineNone">000560| (Int64.logor</div>
+ <div class="lineNone">000561| (Int64.logor</div>
+ <div class="lineNone">000562| (Int64.logor</div>
+ <div class="lineNone">000563| (Int64.logor</div>
+ <div class="lineNone">000564| (Int64.logor</div>
+ <div class="lineNone">000565| (Int64.logor</div>
+ <div class="lineNone">000566| (Int64.shift_left c0 56)</div>
+ <div class="lineNone">000567| (Int64.shift_left c1 48))</div>
+ <div class="lineNone">000568| (Int64.shift_left c2 40))</div>
+ <div class="lineNone">000569| (Int64.shift_left c3 32))</div>
+ <div class="lineNone">000570| (Int64.shift_left c4 24))</div>
+ <div class="lineNone">000571| (Int64.shift_left c5 16))</div>
+ <div class="lineNone">000572| (Int64.shift_left c6 8))</div>
+ <div class="lineNone">000573| c7</div>
+ <div class="lineNone">000574| </div>
+ <div class="lineNone">000575| let _make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 =</div>
+ <div class="lineAllUnvisited">000576| (*[0]*)_make_int64_be c7 c6 c5 c4 c3 c2 c1 c0</div>
+ <div class="lineNone">000577| </div>
+ <div class="lineNone">000578| (* Extract [1..64] bits. We have to consider endianness and signedness. *)</div>
+ <div class="lineNone">000579| let extract_int64_be_unsigned data off len flen =</div>
+ <div class="lineAllVisited">000580| (*[657463]*)let byteoff = off lsr 3 in</div>
<div class="lineNone">000581| </div>
- <div class="lineAllVisited">000582| (*[657463]*)let word =</div>
- <div class="lineNone">000583| (* Optimize the common (byte-aligned) case. *)</div>
- <div class="lineNone">000584| if off land 7 = 0 then (</div>
- <div class="lineAllVisited">000585| (*[203275]*)let word =</div>
- <div class="lineNone">000586| let c0 = _get_byte64 data byteoff strlen in</div>
- <div class="lineAllVisited">000587| (*[203275]*)let c1 = _get_byte64 data (byteoff+1) strlen in</div>
- <div class="lineAllVisited">000588| (*[203275]*)let c2 = _get_byte64 data (byteoff+2) strlen in</div>
- <div class="lineAllVisited">000589| (*[203275]*)let c3 = _get_byte64 data (byteoff+3) strlen in</div>
- <div class="lineAllVisited">000590| (*[203275]*)let c4 = _get_byte64 data (byteoff+4) strlen in</div>
- <div class="lineAllVisited">000591| (*[203275]*)let c5 = _get_byte64 data (byteoff+5) strlen in</div>
- <div class="lineAllVisited">000592| (*[203275]*)let c6 = _get_byte64 data (byteoff+6) strlen in</div>
- <div class="lineAllVisited">000593| (*[203275]*)let c7 = _get_byte64 data (byteoff+7) strlen in</div>
- <div class="lineAllVisited">000594| (*[203275]*)_make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 in</div>
- <div class="lineAllVisited">000595| (*[203275]*)Int64.shift_right_logical word (64 - flen)</div>
- <div class="lineNone">000596| ) else (</div>
- <div class="lineNone">000597| (* Extract the next 64 bits, slow method. *)</div>
- <div class="lineAllVisited">000598| (*[454188]*)let word =</div>
- <div class="lineNone">000599| let c0 = extract_char_unsigned data off len 8</div>
- <div class="lineNone">000600| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000601| (*[454188]*)let c1 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000582| (*[657463]*)let strlen = String.length data in</div>
+ <div class="lineNone">000583| </div>
+ <div class="lineAllVisited">000584| (*[657463]*)let word =</div>
+ <div class="lineNone">000585| (* Optimize the common (byte-aligned) case. *)</div>
+ <div class="lineNone">000586| if off land 7 = 0 then (</div>
+ <div class="lineAllVisited">000587| (*[203307]*)let word =</div>
+ <div class="lineNone">000588| let c0 = _get_byte64 data byteoff strlen in</div>
+ <div class="lineAllVisited">000589| (*[203307]*)let c1 = _get_byte64 data (byteoff+1) strlen in</div>
+ <div class="lineAllVisited">000590| (*[203307]*)let c2 = _get_byte64 data (byteoff+2) strlen in</div>
+ <div class="lineAllVisited">000591| (*[203307]*)let c3 = _get_byte64 data (byteoff+3) strlen in</div>
+ <div class="lineAllVisited">000592| (*[203307]*)let c4 = _get_byte64 data (byteoff+4) strlen in</div>
+ <div class="lineAllVisited">000593| (*[203307]*)let c5 = _get_byte64 data (byteoff+5) strlen in</div>
+ <div class="lineAllVisited">000594| (*[203307]*)let c6 = _get_byte64 data (byteoff+6) strlen in</div>
+ <div class="lineAllVisited">000595| (*[203307]*)let c7 = _get_byte64 data (byteoff+7) strlen in</div>
+ <div class="lineAllVisited">000596| (*[203307]*)_make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 in</div>
+ <div class="lineAllVisited">000597| (*[203307]*)Int64.shift_right_logical word (64 - flen)</div>
+ <div class="lineNone">000598| ) else (</div>
+ <div class="lineNone">000599| (* Extract the next 64 bits, slow method. *)</div>
+ <div class="lineAllVisited">000600| (*[454156]*)let word =</div>
+ <div class="lineNone">000601| let c0 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000602| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000603| (*[454188]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000603| (*[454156]*)let c1 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000604| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000605| (*[454188]*)let c3 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000605| (*[454156]*)let c2 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000606| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000607| (*[454188]*)let c4 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000607| (*[454156]*)let c3 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000608| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000609| (*[454188]*)let c5 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000609| (*[454156]*)let c4 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000610| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000611| (*[454188]*)let c6 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllVisited">000611| (*[454156]*)let c5 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000612| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">000613| (*[454188]*)let c7 = extract_char_unsigned data off len 8 in</div>
- <div class="lineAllVisited">000614| (*[454188]*)let c0 = Int64.of_int c0 in</div>
- <div class="lineAllVisited">000615| (*[454188]*)let c1 = Int64.of_int c1 in</div>
- <div class="lineAllVisited">000616| (*[454188]*)let c2 = Int64.of_int c2 in</div>
- <div class="lineAllVisited">000617| (*[454188]*)let c3 = Int64.of_int c3 in</div>
- <div class="lineAllVisited">000618| (*[454188]*)let c4 = Int64.of_int c4 in</div>
- <div class="lineAllVisited">000619| (*[454188]*)let c5 = Int64.of_int c5 in</div>
- <div class="lineAllVisited">000620| (*[454188]*)let c6 = Int64.of_int c6 in</div>
- <div class="lineAllVisited">000621| (*[454188]*)let c7 = Int64.of_int c7 in</div>
- <div class="lineAllVisited">000622| (*[454188]*)_make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 in</div>
- <div class="lineAllVisited">000623| (*[454188]*)Int64.shift_right_logical word (64 - flen)</div>
- <div class="lineNone">000624| ) in</div>
- <div class="lineAllVisited">000625| (*[657463]*)word (*, off+flen, len-flen*)</div>
- <div class="lineNone">000626| </div>
- <div class="lineNone">000627| let extract_int64_le_unsigned data off len flen =</div>
- <div class="lineAllUnvisited">000628| (*[0]*)let byteoff = off lsr 3 in</div>
- <div class="lineNone">000629| </div>
- <div class="lineAllUnvisited">000630| (*[0]*)let strlen = String.length data in</div>
+ <div class="lineAllVisited">000613| (*[454156]*)let c6 = extract_char_unsigned data off len 8</div>
+ <div class="lineNone">000614| and off = off + 8 and len = len - 8 in</div>
+ <div class="lineAllVisited">000615| (*[454156]*)let c7 = extract_char_unsigned data off len 8 in</div>
+ <div class="lineAllVisited">000616| (*[454156]*)let c0 = Int64.of_int c0 in</div>
+ <div class="lineAllVisited">000617| (*[454156]*)let c1 = Int64.of_int c1 in</div>
+ <div class="lineAllVisited">000618| (*[454156]*)let c2 = Int64.of_int c2 in</div>
+ <div class="lineAllVisited">000619| (*[454156]*)let c3 = Int64.of_int c3 in</div>
+ <div class="lineAllVisited">000620| (*[454156]*)let c4 = Int64.of_int c4 in</div>
+ <div class="lineAllVisited">000621| (*[454156]*)let c5 = Int64.of_int c5 in</div>
+ <div class="lineAllVisited">000622| (*[454156]*)let c6 = Int64.of_int c6 in</div>
+ <div class="lineAllVisited">000623| (*[454156]*)let c7 = Int64.of_int c7 in</div>
+ <div class="lineAllVisited">000624| (*[454156]*)_make_int64_be c0 c1 c2 c3 c4 c5 c6 c7 in</div>
+ <div class="lineAllVisited">000625| (*[454156]*)Int64.shift_right_logical word (64 - flen)</div>
+ <div class="lineNone">000626| ) in</div>
+ <div class="lineAllVisited">000627| (*[657463]*)word (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000628| </div>
+ <div class="lineNone">000629| let extract_int64_le_unsigned data off len flen =</div>
+ <div class="lineAllUnvisited">000630| (*[0]*)let byteoff = off lsr 3 in</div>
<div class="lineNone">000631| </div>
- <div class="lineAllUnvisited">000632| (*[0]*)let word =</div>
- <div class="lineNone">000633| (* Optimize the common (byte-aligned) case. *)</div>
- <div class="lineNone">000634| if off land 7 = 0 then (</div>
- <div class="lineAllUnvisited">000635| (*[0]*)let word =</div>
- <div class="lineNone">000636| let c0 = _get_byte64 data byteoff strlen in</div>
- <div class="lineAllUnvisited">000637| (*[0]*)let c1 = _get_byte64 data (byteoff+1) strlen in</div>
- <div class="lineAllUnvisited">000638| (*[0]*)let c2 = _get_byte64 data (byteoff+2) strlen in</div>
- <div class="lineAllUnvisited">000639| (*[0]*)let c3 = _get_byte64 data (byteoff+3) strlen in</div>
- <div class="lineAllUnvisited">000640| (*[0]*)let c4 = _get_byte64 data (byteoff+4) strlen in</div>
- <div class="lineAllUnvisited">000641| (*[0]*)let c5 = _get_byte64 data (byteoff+5) strlen in</div>
- <div class="lineAllUnvisited">000642| (*[0]*)let c6 = _get_byte64 data (byteoff+6) strlen in</div>
- <div class="lineAllUnvisited">000643| (*[0]*)let c7 = _get_byte64 data (byteoff+7) strlen in</div>
- <div class="lineAllUnvisited">000644| (*[0]*)_make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 in</div>
- <div class="lineAllUnvisited">000645| (*[0]*)Int64.logand word (I64.mask flen)</div>
- <div class="lineNone">000646| ) else (</div>
- <div class="lineNone">000647| (* Extract the next 64 bits, slow method. *)</div>
- <div class="lineAllUnvisited">000648| (*[0]*)let word =</div>
- <div class="lineNone">000649| let c0 = extract_char_unsigned data off len 8</div>
- <div class="lineNone">000650| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000651| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000632| (*[0]*)let strlen = String.length data in</div>
+ <div class="lineNone">000633| </div>
+ <div class="lineAllUnvisited">000634| (*[0]*)let word =</div>
+ <div class="lineNone">000635| (* Optimize the common (byte-aligned) case. *)</div>
+ <div class="lineNone">000636| if off land 7 = 0 then (</div>
+ <div class="lineAllUnvisited">000637| (*[0]*)let word =</div>
+ <div class="lineNone">000638| let c0 = _get_byte64 data byteoff strlen in</div>
+ <div class="lineAllUnvisited">000639| (*[0]*)let c1 = _get_byte64 data (byteoff+1) strlen in</div>
+ <div class="lineAllUnvisited">000640| (*[0]*)let c2 = _get_byte64 data (byteoff+2) strlen in</div>
+ <div class="lineAllUnvisited">000641| (*[0]*)let c3 = _get_byte64 data (byteoff+3) strlen in</div>
+ <div class="lineAllUnvisited">000642| (*[0]*)let c4 = _get_byte64 data (byteoff+4) strlen in</div>
+ <div class="lineAllUnvisited">000643| (*[0]*)let c5 = _get_byte64 data (byteoff+5) strlen in</div>
+ <div class="lineAllUnvisited">000644| (*[0]*)let c6 = _get_byte64 data (byteoff+6) strlen in</div>
+ <div class="lineAllUnvisited">000645| (*[0]*)let c7 = _get_byte64 data (byteoff+7) strlen in</div>
+ <div class="lineAllUnvisited">000646| (*[0]*)_make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 in</div>
+ <div class="lineAllUnvisited">000647| (*[0]*)Int64.logand word (I64.mask flen)</div>
+ <div class="lineNone">000648| ) else (</div>
+ <div class="lineNone">000649| (* Extract the next 64 bits, slow method. *)</div>
+ <div class="lineAllUnvisited">000650| (*[0]*)let word =</div>
+ <div class="lineNone">000651| let c0 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000652| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000653| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000653| (*[0]*)let c1 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000654| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000655| (*[0]*)let c3 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000655| (*[0]*)let c2 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000656| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000657| (*[0]*)let c4 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000657| (*[0]*)let c3 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000658| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000659| (*[0]*)let c5 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000659| (*[0]*)let c4 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000660| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000661| (*[0]*)let c6 = extract_char_unsigned data off len 8</div>
+ <div class="lineAllUnvisited">000661| (*[0]*)let c5 = extract_char_unsigned data off len 8</div>
<div class="lineNone">000662| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllUnvisited">000663| (*[0]*)let c7 = extract_char_unsigned data off len 8 in</div>
- <div class="lineAllUnvisited">000664| (*[0]*)let c0 = Int64.of_int c0 in</div>
- <div class="lineAllUnvisited">000665| (*[0]*)let c1 = Int64.of_int c1 in</div>
- <div class="lineAllUnvisited">000666| (*[0]*)let c2 = Int64.of_int c2 in</div>
- <div class="lineAllUnvisited">000667| (*[0]*)let c3 = Int64.of_int c3 in</div>
- <div class="lineAllUnvisited">000668| (*[0]*)let c4 = Int64.of_int c4 in</div>
- <div class="lineAllUnvisited">000669| (*[0]*)let c5 = Int64.of_int c5 in</div>
- <div class="lineAllUnvisited">000670| (*[0]*)let c6 = Int64.of_int c6 in</div>
- <div class="lineAllUnvisited">000671| (*[0]*)let c7 = Int64.of_int c7 in</div>
- <div class="lineAllUnvisited">000672| (*[0]*)_make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 in</div>
- <div class="lineAllUnvisited">000673| (*[0]*)Int64.logand word (I64.mask flen)</div>
- <div class="lineNone">000674| ) in</div>
- <div class="lineAllUnvisited">000675| (*[0]*)word (*, off+flen, len-flen*)</div>
- <div class="lineNone">000676| </div>
- <div class="lineNone">000677| let extract_int64_ne_unsigned =</div>
- <div class="lineAllVisited">000678| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000679| then (*[0]*)extract_int64_be_unsigned</div>
- <div class="lineAllVisited">000680| else (*[28]*)extract_int64_le_unsigned</div>
- <div class="lineNone">000681| </div>
- <div class="lineNone">000682| let extract_int64_ee_unsigned = function</div>
- <div class="lineAllUnvisited">000683| | BigEndian -> (*[0]*)extract_int64_be_unsigned</div>
- <div class="lineAllUnvisited">000684| | LittleEndian -> (*[0]*)extract_int64_le_unsigned</div>
- <div class="lineAllUnvisited">000685| | NativeEndian -> (*[0]*)extract_int64_ne_unsigned</div>
- <div class="lineNone">000686| </div>
- <div class="lineNone">000687| external extract_fastpath_int16_be_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_be_unsigned" "noalloc"</div>
+ <div class="lineAllUnvisited">000663| (*[0]*)let c6 = extract_char_unsigned data off len 8</div>
+ <div class="lineNone">000664| and off = off + 8 and len = len - 8 in</div>
+ <div class="lineAllUnvisited">000665| (*[0]*)let c7 = extract_char_unsigned data off len 8 in</div>
+ <div class="lineAllUnvisited">000666| (*[0]*)let c0 = Int64.of_int c0 in</div>
+ <div class="lineAllUnvisited">000667| (*[0]*)let c1 = Int64.of_int c1 in</div>
+ <div class="lineAllUnvisited">000668| (*[0]*)let c2 = Int64.of_int c2 in</div>
+ <div class="lineAllUnvisited">000669| (*[0]*)let c3 = Int64.of_int c3 in</div>
+ <div class="lineAllUnvisited">000670| (*[0]*)let c4 = Int64.of_int c4 in</div>
+ <div class="lineAllUnvisited">000671| (*[0]*)let c5 = Int64.of_int c5 in</div>
+ <div class="lineAllUnvisited">000672| (*[0]*)let c6 = Int64.of_int c6 in</div>
+ <div class="lineAllUnvisited">000673| (*[0]*)let c7 = Int64.of_int c7 in</div>
+ <div class="lineAllUnvisited">000674| (*[0]*)_make_int64_le c0 c1 c2 c3 c4 c5 c6 c7 in</div>
+ <div class="lineAllUnvisited">000675| (*[0]*)Int64.logand word (I64.mask flen)</div>
+ <div class="lineNone">000676| ) in</div>
+ <div class="lineAllUnvisited">000677| (*[0]*)word (*, off+flen, len-flen*)</div>
+ <div class="lineNone">000678| </div>
+ <div class="lineNone">000679| let extract_int64_ne_unsigned =</div>
+ <div class="lineAllVisited">000680| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000681| then (*[0]*)extract_int64_be_unsigned</div>
+ <div class="lineAllVisited">000682| else (*[34]*)extract_int64_le_unsigned</div>
+ <div class="lineNone">000683| </div>
+ <div class="lineNone">000684| let extract_int64_ee_unsigned = function</div>
+ <div class="lineAllUnvisited">000685| | BigEndian -> (*[0]*)extract_int64_be_unsigned</div>
+ <div class="lineAllUnvisited">000686| | LittleEndian -> (*[0]*)extract_int64_le_unsigned</div>
+ <div class="lineAllUnvisited">000687| | NativeEndian -> (*[0]*)extract_int64_ne_unsigned</div>
<div class="lineNone">000688| </div>
- <div class="lineNone">000689| external extract_fastpath_int16_le_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000689| external extract_fastpath_int16_be_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_be_unsigned" "noalloc"</div>
<div class="lineNone">000690| </div>
- <div class="lineNone">000691| external extract_fastpath_int16_ne_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000691| external extract_fastpath_int16_le_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_le_unsigned" "noalloc"</div>
<div class="lineNone">000692| </div>
- <div class="lineNone">000693| external extract_fastpath_int16_be_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_be_signed" "noalloc"</div>
+ <div class="lineNone">000693| external extract_fastpath_int16_ne_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_ne_unsigned" "noalloc"</div>
<div class="lineNone">000694| </div>
- <div class="lineNone">000695| external extract_fastpath_int16_le_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_le_signed" "noalloc"</div>
+ <div class="lineNone">000695| external extract_fastpath_int16_be_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_be_signed" "noalloc"</div>
<div class="lineNone">000696| </div>
- <div class="lineNone">000697| external extract_fastpath_int16_ne_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_ne_signed" "noalloc"</div>
+ <div class="lineNone">000697| external extract_fastpath_int16_le_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_le_signed" "noalloc"</div>
<div class="lineNone">000698| </div>
- <div class="lineNone">000699| (*</div>
- <div class="lineNone">000700| external extract_fastpath_int24_be_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_be_unsigned" "noalloc"</div>
- <div class="lineNone">000701| </div>
- <div class="lineNone">000702| external extract_fastpath_int24_le_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000699| external extract_fastpath_int16_ne_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int16_ne_signed" "noalloc"</div>
+ <div class="lineNone">000700| </div>
+ <div class="lineNone">000701| (*</div>
+ <div class="lineNone">000702| external extract_fastpath_int24_be_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_be_unsigned" "noalloc"</div>
<div class="lineNone">000703| </div>
- <div class="lineNone">000704| external extract_fastpath_int24_ne_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000704| external extract_fastpath_int24_le_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_le_unsigned" "noalloc"</div>
<div class="lineNone">000705| </div>
- <div class="lineNone">000706| external extract_fastpath_int24_be_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_be_signed" "noalloc"</div>
+ <div class="lineNone">000706| external extract_fastpath_int24_ne_unsigned : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_ne_unsigned" "noalloc"</div>
<div class="lineNone">000707| </div>
- <div class="lineNone">000708| external extract_fastpath_int24_le_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_le_signed" "noalloc"</div>
+ <div class="lineNone">000708| external extract_fastpath_int24_be_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_be_signed" "noalloc"</div>
<div class="lineNone">000709| </div>
- <div class="lineNone">000710| external extract_fastpath_int24_ne_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_ne_signed" "noalloc"</div>
- <div class="lineNone">000711| *)</div>
- <div class="lineNone">000712| </div>
- <div class="lineNone">000713| external extract_fastpath_int32_be_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_be_unsigned" "noalloc"</div>
+ <div class="lineNone">000710| external extract_fastpath_int24_le_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_le_signed" "noalloc"</div>
+ <div class="lineNone">000711| </div>
+ <div class="lineNone">000712| external extract_fastpath_int24_ne_signed : string -> int -> int = "ocaml_bitstring_extract_fastpath_int24_ne_signed" "noalloc"</div>
+ <div class="lineNone">000713| *)</div>
<div class="lineNone">000714| </div>
- <div class="lineNone">000715| external extract_fastpath_int32_le_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000715| external extract_fastpath_int32_be_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_be_unsigned" "noalloc"</div>
<div class="lineNone">000716| </div>
- <div class="lineNone">000717| external extract_fastpath_int32_ne_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000717| external extract_fastpath_int32_le_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_le_unsigned" "noalloc"</div>
<div class="lineNone">000718| </div>
- <div class="lineNone">000719| external extract_fastpath_int32_be_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_be_signed" "noalloc"</div>
+ <div class="lineNone">000719| external extract_fastpath_int32_ne_unsigned : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_ne_unsigned" "noalloc"</div>
<div class="lineNone">000720| </div>
- <div class="lineNone">000721| external extract_fastpath_int32_le_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_le_signed" "noalloc"</div>
+ <div class="lineNone">000721| external extract_fastpath_int32_be_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_be_signed" "noalloc"</div>
<div class="lineNone">000722| </div>
- <div class="lineNone">000723| external extract_fastpath_int32_ne_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_ne_signed" "noalloc"</div>
+ <div class="lineNone">000723| external extract_fastpath_int32_le_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_le_signed" "noalloc"</div>
<div class="lineNone">000724| </div>
- <div class="lineNone">000725| (*</div>
- <div class="lineNone">000726| external extract_fastpath_int40_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_be_unsigned" "noalloc"</div>
- <div class="lineNone">000727| </div>
- <div class="lineNone">000728| external extract_fastpath_int40_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000725| external extract_fastpath_int32_ne_signed : string -> int -> int32 -> int32 = "ocaml_bitstring_extract_fastpath_int32_ne_signed" "noalloc"</div>
+ <div class="lineNone">000726| </div>
+ <div class="lineNone">000727| (*</div>
+ <div class="lineNone">000728| external extract_fastpath_int40_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_be_unsigned" "noalloc"</div>
<div class="lineNone">000729| </div>
- <div class="lineNone">000730| external extract_fastpath_int40_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000730| external extract_fastpath_int40_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_le_unsigned" "noalloc"</div>
<div class="lineNone">000731| </div>
- <div class="lineNone">000732| external extract_fastpath_int40_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_be_signed" "noalloc"</div>
+ <div class="lineNone">000732| external extract_fastpath_int40_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_ne_unsigned" "noalloc"</div>
<div class="lineNone">000733| </div>
- <div class="lineNone">000734| external extract_fastpath_int40_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_le_signed" "noalloc"</div>
+ <div class="lineNone">000734| external extract_fastpath_int40_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_be_signed" "noalloc"</div>
<div class="lineNone">000735| </div>
- <div class="lineNone">000736| external extract_fastpath_int40_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_ne_signed" "noalloc"</div>
+ <div class="lineNone">000736| external extract_fastpath_int40_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_le_signed" "noalloc"</div>
<div class="lineNone">000737| </div>
- <div class="lineNone">000738| external extract_fastpath_int48_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_be_unsigned" "noalloc"</div>
+ <div class="lineNone">000738| external extract_fastpath_int40_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int40_ne_signed" "noalloc"</div>
<div class="lineNone">000739| </div>
- <div class="lineNone">000740| external extract_fastpath_int48_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000740| external extract_fastpath_int48_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_be_unsigned" "noalloc"</div>
<div class="lineNone">000741| </div>
- <div class="lineNone">000742| external extract_fastpath_int48_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000742| external extract_fastpath_int48_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_le_unsigned" "noalloc"</div>
<div class="lineNone">000743| </div>
- <div class="lineNone">000744| external extract_fastpath_int48_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_be_signed" "noalloc"</div>
+ <div class="lineNone">000744| external extract_fastpath_int48_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_ne_unsigned" "noalloc"</div>
<div class="lineNone">000745| </div>
- <div class="lineNone">000746| external extract_fastpath_int48_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_le_signed" "noalloc"</div>
+ <div class="lineNone">000746| external extract_fastpath_int48_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_be_signed" "noalloc"</div>
<div class="lineNone">000747| </div>
- <div class="lineNone">000748| external extract_fastpath_int48_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_ne_signed" "noalloc"</div>
+ <div class="lineNone">000748| external extract_fastpath_int48_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_le_signed" "noalloc"</div>
<div class="lineNone">000749| </div>
- <div class="lineNone">000750| external extract_fastpath_int56_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_be_unsigned" "noalloc"</div>
+ <div class="lineNone">000750| external extract_fastpath_int48_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int48_ne_signed" "noalloc"</div>
<div class="lineNone">000751| </div>
- <div class="lineNone">000752| external extract_fastpath_int56_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000752| external extract_fastpath_int56_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_be_unsigned" "noalloc"</div>
<div class="lineNone">000753| </div>
- <div class="lineNone">000754| external extract_fastpath_int56_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000754| external extract_fastpath_int56_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_le_unsigned" "noalloc"</div>
<div class="lineNone">000755| </div>
- <div class="lineNone">000756| external extract_fastpath_int56_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_be_signed" "noalloc"</div>
+ <div class="lineNone">000756| external extract_fastpath_int56_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_ne_unsigned" "noalloc"</div>
<div class="lineNone">000757| </div>
- <div class="lineNone">000758| external extract_fastpath_int56_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_le_signed" "noalloc"</div>
+ <div class="lineNone">000758| external extract_fastpath_int56_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_be_signed" "noalloc"</div>
<div class="lineNone">000759| </div>
- <div class="lineNone">000760| external extract_fastpath_int56_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_ne_signed" "noalloc"</div>
- <div class="lineNone">000761| *)</div>
- <div class="lineNone">000762| </div>
- <div class="lineNone">000763| external extract_fastpath_int64_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_be_unsigned" "noalloc"</div>
+ <div class="lineNone">000760| external extract_fastpath_int56_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_le_signed" "noalloc"</div>
+ <div class="lineNone">000761| </div>
+ <div class="lineNone">000762| external extract_fastpath_int56_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int56_ne_signed" "noalloc"</div>
+ <div class="lineNone">000763| *)</div>
<div class="lineNone">000764| </div>
- <div class="lineNone">000765| external extract_fastpath_int64_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_le_unsigned" "noalloc"</div>
+ <div class="lineNone">000765| external extract_fastpath_int64_be_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_be_unsigned" "noalloc"</div>
<div class="lineNone">000766| </div>
- <div class="lineNone">000767| external extract_fastpath_int64_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_ne_unsigned" "noalloc"</div>
+ <div class="lineNone">000767| external extract_fastpath_int64_le_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_le_unsigned" "noalloc"</div>
<div class="lineNone">000768| </div>
- <div class="lineNone">000769| external extract_fastpath_int64_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_be_signed" "noalloc"</div>
+ <div class="lineNone">000769| external extract_fastpath_int64_ne_unsigned : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_ne_unsigned" "noalloc"</div>
<div class="lineNone">000770| </div>
- <div class="lineNone">000771| external extract_fastpath_int64_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_le_signed" "noalloc"</div>
+ <div class="lineNone">000771| external extract_fastpath_int64_be_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_be_signed" "noalloc"</div>
<div class="lineNone">000772| </div>
- <div class="lineNone">000773| external extract_fastpath_int64_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_ne_signed" "noalloc"</div>
+ <div class="lineNone">000773| external extract_fastpath_int64_le_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_le_signed" "noalloc"</div>
<div class="lineNone">000774| </div>
- <div class="lineNone">000775| (*----------------------------------------------------------------------*)</div>
- <div class="lineNone">000776| (* Constructor functions. *)</div>
- <div class="lineNone">000777| </div>
- <div class="lineNone">000778| module Buffer = struct</div>
- <div class="lineNone">000779| type t = {</div>
- <div class="lineNone">000780| buf : Buffer.t;</div>
- <div class="lineNone">000781| mutable len : int; (* Length in bits. *)</div>
- <div class="lineNone">000782| (* Last byte in the buffer (if len is not aligned). We store</div>
- <div class="lineNone">000783| * it outside the buffer because buffers aren't mutable.</div>
- <div class="lineNone">000784| *)</div>
- <div class="lineNone">000785| mutable last : int;</div>
- <div class="lineNone">000786| }</div>
- <div class="lineNone">000787| </div>
- <div class="lineNone">000788| let create () =</div>
- <div class="lineNone">000789| (* XXX We have almost enough information in the generator to</div>
- <div class="lineNone">000790| * choose a good initial size.</div>
- <div class="lineNone">000791| *)</div>
- <div class="lineAllVisited">000792| (*[452559]*){ buf = Buffer.create 128; len = 0; last = 0 }</div>
- <div class="lineNone">000793| </div>
- <div class="lineNone">000794| let contents { buf = buf; len = len; last = last } =</div>
- <div class="lineAllVisited">000795| (*[452559]*)let data =</div>
- <div class="lineNone">000796| if len land 7 = 0 then</div>
- <div class="lineAllVisited">000797| (*[58202]*)Buffer.contents buf</div>
- <div class="lineNone">000798| else</div>
- <div class="lineAllVisited">000799| (*[394357]*)Buffer.contents buf ^ (String.make 1 (Char.chr last)) in</div>
- <div class="lineAllVisited">000800| (*[452559]*)data, 0, len</div>
- <div class="lineNone">000801| </div>
- <div class="lineNone">000802| (* Add exactly 8 bits. *)</div>
- <div class="lineNone">000803| let add_byte ({ buf = buf; len = len; last = last } as t) byte =</div>
- <div class="lineMixed">000804| (*[8142106]*)if (*[8142106]*)byte < 0 || (*[8142106]*)byte > 255 then (*[0]*)invalid_arg "Bitstring.Buffer.add_byte";</div>
- <div class="lineAllVisited">000805| (*[8142106]*)let shift = len land 7 in</div>
- <div class="lineAllVisited">000806| (*[8142106]*)if shift = 0 then</div>
- <div class="lineNone">000807| (* Target buffer is byte-aligned. *)</div>
- <div class="lineAllVisited">000808| (*[519924]*)Buffer.add_char buf (Char.chr byte)</div>
- <div class="lineNone">000809| else (</div>
- <div class="lineNone">000810| (* Target buffer is unaligned. 'last' is meaningful. *)</div>
- <div class="lineAllVisited">000811| (*[7622182]*)let first = byte lsr shift in</div>
- <div class="lineAllVisited">000812| (*[7622182]*)let second = (byte lsl (8 - shift)) land 0xff in</div>
- <div class="lineAllVisited">000813| (*[7622182]*)Buffer.add_char buf (*[7622182]*)(Char.chr (last lor first));</div>
- <div class="lineAllVisited">000814| (*[7622182]*)t.last <- second</div>
- <div class="lineNone">000815| );</div>
- <div class="lineAllVisited">000816| (*[8142106]*)t.len <- t.len + 8</div>
- <div class="lineNone">000817| </div>
- <div class="lineNone">000818| (* Add exactly 1 bit. *)</div>
- <div class="lineNone">000819| let add_bit ({ buf = buf; len = len; last = last } as t) bit =</div>
- <div class="lineAllVisited">000820| (*[4192108]*)let shift = 7 - (len land 7) in</div>
- <div class="lineAllVisited">000821| (*[4192108]*)if shift > 0 then</div>
- <div class="lineNone">000822| (* Somewhere in the middle of 'last'. *)</div>
- <div class="lineAllVisited">000823| (*[3692102]*)t.last <- last lor ((if bit then (*[2903776]*)1 else (*[788326]*)0) lsl shift)</div>
- <div class="lineNone">000824| else (</div>
- <div class="lineNone">000825| (* Just a single spare bit in 'last'. *)</div>
- <div class="lineAllVisited">000826| (*[500006]*)let last = last lor if bit then (*[391339]*)1 else (*[108667]*)0 in</div>
- <div class="lineAllVisited">000827| (*[500006]*)Buffer.add_char buf (*[500006]*)(Char.chr last);</div>
- <div class="lineAllVisited">000828| (*[500006]*)t.last <- 0</div>
- <div class="lineNone">000829| );</div>
- <div class="lineAllVisited">000830| (*[4192108]*)t.len <- len + 1</div>
- <div class="lineNone">000831| </div>
- <div class="lineNone">000832| (* Add a small number of bits (definitely < 8). This uses a loop</div>
- <div class="lineNone">000833| * to call add_bit so it's slow.</div>
- <div class="lineNone">000834| *)</div>
- <div class="lineNone">000835| let _add_bits t c slen =</div>
- <div class="lineMixed">000836| (*[317200]*)if (*[317200]*)slen < 1 || (*[317200]*)slen >= 8 then (*[0]*)invalid_arg "Bitstring.Buffer._add_bits";</div>
- <div class="lineAllVisited">000837| (*[317200]*)for i = slen-1 downto 0 do</div>
- <div class="lineAllVisited">000838| (*[1268791]*)let bit = c land (1 lsl i) <> 0 in</div>
- <div class="lineAllVisited">000839| (*[1268791]*)add_bit t bit</div>
- <div class="lineNone">000840| done</div>
- <div class="lineNone">000841| </div>
- <div class="lineNone">000842| let add_bits ({ buf = buf; len = len } as t) str slen =</div>
- <div class="lineAllVisited">000843| (*[23330]*)if slen > 0 then (</div>
- <div class="lineAllVisited">000844| (*[1272292]*)if len land 7 = 0 then (</div>
- <div class="lineAllVisited">000845| (*[525820]*)if slen land 7 = 0 then</div>
- <div class="lineNone">000846| (* Common case - everything is byte-aligned. *)</div>
- <div class="lineAllVisited">000847| (*[58261]*)Buffer.add_substring buf str 0 (slen lsr 3)</div>
- <div class="lineNone">000848| else (</div>
- <div class="lineNone">000849| (* Target buffer is aligned. Copy whole bytes then leave the</div>
- <div class="lineNone">000850| * remaining bits in last.</div>
- <div class="lineNone">000851| *)</div>
- <div class="lineAllVisited">000852| (*[467559]*)let slenbytes = slen lsr 3 in</div>
- <div class="lineAllVisited">000853| (*[335078]*)if slenbytes > 0 then (*[132481]*)Buffer.add_substring buf str 0 slenbytes;</div>
- <div class="lineAllVisited">000854| (*[467559]*)let last = Char.code str.[slenbytes] in (* last char *)</div>
- <div class="lineAllVisited">000855| (*[467559]*)let mask = 0xff lsl (8 - (slen land 7)) in</div>
- <div class="lineAllVisited">000856| (*[467559]*)t.last <- last land mask</div>
- <div class="lineNone">000857| );</div>
- <div class="lineAllVisited">000858| (*[525820]*)t.len <- len + slen</div>
- <div class="lineNone">000859| ) else (</div>
- <div class="lineNone">000860| (* Target buffer is unaligned. Copy whole bytes using</div>
- <div class="lineNone">000861| * add_byte which knows how to deal with an unaligned</div>
- <div class="lineNone">000862| * target buffer, then call add_bit for the remaining < 8 bits.</div>
- <div class="lineNone">000863| *</div>
- <div class="lineNone">000864| * XXX This is going to be dog-slow.</div>
- <div class="lineNone">000865| *)</div>
- <div class="lineAllVisited">000866| (*[746472]*)let slenbytes = slen lsr 3 in</div>
- <div class="lineAllVisited">000867| (*[746472]*)for i = 0 to slenbytes-1 do</div>
- <div class="lineAllVisited">000868| (*[5829660]*)let byte = Char.code str.[i] in</div>
- <div class="lineAllVisited">000869| (*[5829660]*)add_byte t byte</div>
- <div class="lineNone">000870| done;</div>
- <div class="lineAllVisited">000871| (*[746472]*)let bitsleft = slen - (slenbytes lsl 3) in</div>
- <div class="lineAllVisited">000872| (*[136479]*)if bitsleft > 0 then (</div>
- <div class="lineAllVisited">000873| (*[609993]*)let c = Char.code str.[slenbytes] in</div>
- <div class="lineAllVisited">000874| (*[609993]*)for i = 0 to bitsleft - 1 do</div>
- <div class="lineAllVisited">000875| (*[2423817]*)let bit = c land (0x80 lsr i) <> 0 in</div>
- <div class="lineAllVisited">000876| (*[2423817]*)add_bit t bit</div>
- <div class="lineNone">000877| done</div>
- <div class="lineNone">000878| )</div>
- <div class="lineNone">000879| );</div>
- <div class="lineNone">000880| )</div>
- <div class="lineNone">000881| end</div>
- <div class="lineNone">000882| </div>
- <div class="lineNone">000883| (* Construct a single bit. *)</div>
- <div class="lineNone">000884| let construct_bit buf b _ _ =</div>
- <div class="lineAllUnvisited">000885| (*[0]*)Buffer.add_bit buf b</div>
- <div class="lineNone">000886| </div>
- <div class="lineNone">000887| (* Construct a field, flen = [2..8]. *)</div>
- <div class="lineNone">000888| let construct_char_unsigned buf v flen exn =</div>
- <div class="lineAllVisited">000889| (*[1203570]*)let max_val = 1 lsl flen in</div>
- <div class="lineMixed">000890| (*[1203570]*)if (*[1203570]*)v < 0 || (*[1203570]*)v >= max_val then (*[0]*)raise exn;</div>
- <div class="lineAllVisited">000891| (*[1203570]*)if flen = 8 then</div>
- <div class="lineAllVisited">000892| (*[1203570]*)Buffer.add_byte buf v</div>
- <div class="lineNone">000893| else</div>
- <div class="lineAllUnvisited">000894| (*[0]*)Buffer._add_bits buf v flen</div>
- <div class="lineNone">000895| </div>
- <div class="lineNone">000896| (* Construct a field of up to 31 bits. *)</div>
- <div class="lineNone">000897| let construct_int_be_unsigned buf v flen exn =</div>
- <div class="lineNone">000898| (* Check value is within range. *)</div>
- <div class="lineMixed">000899| (*[2]*)if not (I.range_unsigned v flen) then (*[0]*)raise exn;</div>
- <div class="lineNone">000900| (* Add the bytes. *)</div>
- <div class="lineAllVisited">000901| (*[2]*)I.map_bytes_be (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
- <div class="lineNone">000902| </div>
- <div class="lineNone">000903| (* Construct a field of up to 31 bits. *)</div>
- <div class="lineNone">000904| let construct_int_le_unsigned buf v flen exn =</div>
- <div class="lineNone">000905| (* Check value is within range. *)</div>
- <div class="lineAllUnvisited">000906| (*[0]*)if not (I.range_unsigned v flen) then (*[0]*)raise exn;</div>
- <div class="lineNone">000907| (* Add the bytes. *)</div>
- <div class="lineAllUnvisited">000908| (*[0]*)I.map_bytes_le (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
- <div class="lineNone">000909| </div>
- <div class="lineNone">000910| let construct_int_ne_unsigned =</div>
- <div class="lineAllVisited">000911| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000912| then (*[0]*)construct_int_be_unsigned</div>
- <div class="lineAllVisited">000913| else (*[28]*)construct_int_le_unsigned</div>
- <div class="lineNone">000914| </div>
- <div class="lineNone">000915| let construct_int_ee_unsigned = function</div>
- <div class="lineAllUnvisited">000916| | BigEndian -> (*[0]*)construct_int_be_unsigned</div>
- <div class="lineAllUnvisited">000917| | LittleEndian -> (*[0]*)construct_int_le_unsigned</div>
- <div class="lineAllUnvisited">000918| | NativeEndian -> (*[0]*)construct_int_ne_unsigned</div>
- <div class="lineNone">000919| </div>
- <div class="lineNone">000920| (* Construct a field of exactly 32 bits. *)</div>
- <div class="lineNone">000921| let construct_int32_be_unsigned buf v flen _ =</div>
- <div class="lineAllVisited">000922| (*[6]*)Buffer.add_byte buf</div>
- <div class="lineNone">000923| (Int32.to_int (Int32.shift_right_logical v 24));</div>
+ <div class="lineNone">000775| external extract_fastpath_int64_ne_signed : string -> int -> int64 -> int64 = "ocaml_bitstring_extract_fastpath_int64_ne_signed" "noalloc"</div>
+ <div class="lineNone">000776| </div>
+ <div class="lineNone">000777| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">000778| (* Constructor functions. *)</div>
+ <div class="lineNone">000779| </div>
+ <div class="lineNone">000780| module Buffer = struct</div>
+ <div class="lineNone">000781| type t = {</div>
+ <div class="lineNone">000782| buf : Buffer.t;</div>
+ <div class="lineNone">000783| mutable len : int; (* Length in bits. *)</div>
+ <div class="lineNone">000784| (* Last byte in the buffer (if len is not aligned). We store</div>
+ <div class="lineNone">000785| * it outside the buffer because buffers aren't mutable.</div>
+ <div class="lineNone">000786| *)</div>
+ <div class="lineNone">000787| mutable last : int;</div>
+ <div class="lineNone">000788| }</div>
+ <div class="lineNone">000789| </div>
+ <div class="lineNone">000790| let create () =</div>
+ <div class="lineNone">000791| (* XXX We have almost enough information in the generator to</div>
+ <div class="lineNone">000792| * choose a good initial size.</div>
+ <div class="lineNone">000793| *)</div>
+ <div class="lineAllVisited">000794| (*[493022]*){ buf = Buffer.create 128; len = 0; last = 0 }</div>
+ <div class="lineNone">000795| </div>
+ <div class="lineNone">000796| let contents { buf = buf; len = len; last = last } =</div>
+ <div class="lineAllVisited">000797| (*[493022]*)let data =</div>
+ <div class="lineNone">000798| if len land 7 = 0 then</div>
+ <div class="lineAllVisited">000799| (*[63287]*)Buffer.contents buf</div>
+ <div class="lineNone">000800| else</div>
+ <div class="lineAllVisited">000801| (*[429735]*)Buffer.contents buf ^ (String.make 1 (Char.chr last)) in</div>
+ <div class="lineAllVisited">000802| (*[493022]*)data, 0, len</div>
+ <div class="lineNone">000803| </div>
+ <div class="lineNone">000804| (* Add exactly 8 bits. *)</div>
+ <div class="lineNone">000805| let add_byte ({ buf = buf; len = len; last = last } as t) byte =</div>
+ <div class="lineMixed">000806| (*[8255562]*)if (*[8255562]*)byte < 0 || (*[8255562]*)byte > 255 then (*[0]*)invalid_arg "Bitstring.Buffer.add_byte";</div>
+ <div class="lineAllVisited">000807| (*[8255562]*)let shift = len land 7 in</div>
+ <div class="lineAllVisited">000808| (*[8255562]*)if shift = 0 then</div>
+ <div class="lineNone">000809| (* Target buffer is byte-aligned. *)</div>
+ <div class="lineAllVisited">000810| (*[519924]*)Buffer.add_char buf (Char.chr byte)</div>
+ <div class="lineNone">000811| else (</div>
+ <div class="lineNone">000812| (* Target buffer is unaligned. 'last' is meaningful. *)</div>
+ <div class="lineAllVisited">000813| (*[7735638]*)let first = byte lsr shift in</div>
+ <div class="lineAllVisited">000814| (*[7735638]*)let second = (byte lsl (8 - shift)) land 0xff in</div>
+ <div class="lineAllVisited">000815| (*[7735638]*)Buffer.add_char buf (*[7735638]*)(Char.chr (last lor first));</div>
+ <div class="lineAllVisited">000816| (*[7735638]*)t.last <- second</div>
+ <div class="lineNone">000817| );</div>
+ <div class="lineAllVisited">000818| (*[8255562]*)t.len <- t.len + 8</div>
+ <div class="lineNone">000819| </div>
+ <div class="lineNone">000820| (* Add exactly 1 bit. *)</div>
+ <div class="lineNone">000821| let add_bit ({ buf = buf; len = len; last = last } as t) bit =</div>
+ <div class="lineAllVisited">000822| (*[4421229]*)let shift = 7 - (len land 7) in</div>
+ <div class="lineAllVisited">000823| (*[4421229]*)if shift > 0 then</div>
+ <div class="lineNone">000824| (* Somewhere in the middle of 'last'. *)</div>
+ <div class="lineAllVisited">000825| (*[3888935]*)t.last <- last lor ((if bit then (*[3003091]*)1 else (*[885844]*)0) lsl shift)</div>
+ <div class="lineNone">000826| else (</div>
+ <div class="lineNone">000827| (* Just a single spare bit in 'last'. *)</div>
+ <div class="lineAllVisited">000828| (*[532294]*)let last = last lor if bit then (*[407635]*)1 else (*[124659]*)0 in</div>
+ <div class="lineAllVisited">000829| (*[532294]*)Buffer.add_char buf (*[532294]*)(Char.chr last);</div>
+ <div class="lineAllVisited">000830| (*[532294]*)t.last <- 0</div>
+ <div class="lineNone">000831| );</div>
+ <div class="lineAllVisited">000832| (*[4421229]*)t.len <- len + 1</div>
+ <div class="lineNone">000833| </div>
+ <div class="lineNone">000834| (* Add a small number of bits (definitely < 8). This uses a loop</div>
+ <div class="lineNone">000835| * to call add_bit so it's slow.</div>
+ <div class="lineNone">000836| *)</div>
+ <div class="lineNone">000837| let _add_bits t c slen =</div>
+ <div class="lineMixed">000838| (*[317200]*)if (*[317200]*)slen < 1 || (*[317200]*)slen >= 8 then (*[0]*)invalid_arg "Bitstring.Buffer._add_bits";</div>
+ <div class="lineAllVisited">000839| (*[317200]*)for i = slen-1 downto 0 do</div>
+ <div class="lineAllVisited">000840| (*[1268974]*)let bit = c land (1 lsl i) <> 0 in</div>
+ <div class="lineAllVisited">000841| (*[1268974]*)add_bit t bit</div>
+ <div class="lineNone">000842| done</div>
+ <div class="lineNone">000843| </div>
+ <div class="lineNone">000844| let add_bits ({ buf = buf; len = len } as t) str slen =</div>
+ <div class="lineAllVisited">000845| (*[26866]*)if slen > 0 then (</div>
+ <div class="lineAllVisited">000846| (*[1388985]*)if len land 7 = 0 then (</div>
+ <div class="lineAllVisited">000847| (*[575655]*)if slen land 7 = 0 then</div>
+ <div class="lineNone">000848| (* Common case - everything is byte-aligned. *)</div>
+ <div class="lineAllVisited">000849| (*[64306]*)Buffer.add_substring buf str 0 (slen lsr 3)</div>
+ <div class="lineNone">000850| else (</div>
+ <div class="lineNone">000851| (* Target buffer is aligned. Copy whole bytes then leave the</div>
+ <div class="lineNone">000852| * remaining bits in last.</div>
+ <div class="lineNone">000853| *)</div>
+ <div class="lineAllVisited">000854| (*[511349]*)let slenbytes = slen lsr 3 in</div>
+ <div class="lineAllVisited">000855| (*[345648]*)if slenbytes > 0 then (*[165701]*)Buffer.add_substring buf str 0 slenbytes;</div>
+ <div class="lineAllVisited">000856| (*[511349]*)let last = Char.code str.[slenbytes] in (* last char *)</div>
+ <div class="lineAllVisited">000857| (*[511349]*)let mask = 0xff lsl (8 - (slen land 7)) in</div>
+ <div class="lineAllVisited">000858| (*[511349]*)t.last <- last land mask</div>
+ <div class="lineNone">000859| );</div>
+ <div class="lineAllVisited">000860| (*[575655]*)t.len <- len + slen</div>
+ <div class="lineNone">000861| ) else (</div>
+ <div class="lineNone">000862| (* Target buffer is unaligned. Copy whole bytes using</div>
+ <div class="lineNone">000863| * add_byte which knows how to deal with an unaligned</div>
+ <div class="lineNone">000864| * target buffer, then call add_bit for the remaining < 8 bits.</div>
+ <div class="lineNone">000865| *</div>
+ <div class="lineNone">000866| * XXX This is going to be dog-slow.</div>
+ <div class="lineNone">000867| *)</div>
+ <div class="lineAllVisited">000868| (*[813330]*)let slenbytes = slen lsr 3 in</div>
+ <div class="lineAllVisited">000869| (*[813330]*)for i = 0 to slenbytes-1 do</div>
+ <div class="lineAllVisited">000870| (*[5943116]*)let byte = Char.code str.[i] in</div>
+ <div class="lineAllVisited">000871| (*[5943116]*)add_byte t byte</div>
+ <div class="lineNone">000872| done;</div>
+ <div class="lineAllVisited">000873| (*[813330]*)let bitsleft = slen - (slenbytes lsl 3) in</div>
+ <div class="lineAllVisited">000874| (*[144583]*)if bitsleft > 0 then (</div>
+ <div class="lineAllVisited">000875| (*[668747]*)let c = Char.code str.[slenbytes] in</div>
+ <div class="lineAllVisited">000876| (*[668747]*)for i = 0 to bitsleft - 1 do</div>
+ <div class="lineAllVisited">000877| (*[2652755]*)let bit = c land (0x80 lsr i) <> 0 in</div>
+ <div class="lineAllVisited">000878| (*[2652755]*)add_bit t bit</div>
+ <div class="lineNone">000879| done</div>
+ <div class="lineNone">000880| )</div>
+ <div class="lineNone">000881| );</div>
+ <div class="lineNone">000882| )</div>
+ <div class="lineNone">000883| end</div>
+ <div class="lineNone">000884| </div>
+ <div class="lineNone">000885| (* Construct a single bit. *)</div>
+ <div class="lineNone">000886| let construct_bit buf b _ _ =</div>
+ <div class="lineAllUnvisited">000887| (*[0]*)Buffer.add_bit buf b</div>
+ <div class="lineNone">000888| </div>
+ <div class="lineNone">000889| (* Construct a field, flen = [2..8]. *)</div>
+ <div class="lineNone">000890| let construct_char_unsigned buf v flen exn =</div>
+ <div class="lineAllVisited">000891| (*[1203570]*)let max_val = 1 lsl flen in</div>
+ <div class="lineMixed">000892| (*[1203570]*)if (*[1203570]*)v < 0 || (*[1203570]*)v >= max_val then (*[0]*)raise exn;</div>
+ <div class="lineAllVisited">000893| (*[1203570]*)if flen = 8 then</div>
+ <div class="lineAllVisited">000894| (*[1203570]*)Buffer.add_byte buf v</div>
+ <div class="lineNone">000895| else</div>
+ <div class="lineAllUnvisited">000896| (*[0]*)Buffer._add_bits buf v flen</div>
+ <div class="lineNone">000897| </div>
+ <div class="lineNone">000898| (* Construct a field of up to 31 bits. *)</div>
+ <div class="lineNone">000899| let construct_int_be_unsigned buf v flen exn =</div>
+ <div class="lineNone">000900| (* Check value is within range. *)</div>
+ <div class="lineMixed">000901| (*[2]*)if not (I.range_unsigned v flen) then (*[0]*)raise exn;</div>
+ <div class="lineNone">000902| (* Add the bytes. *)</div>
+ <div class="lineAllVisited">000903| (*[2]*)I.map_bytes_be (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
+ <div class="lineNone">000904| </div>
+ <div class="lineNone">000905| (* Construct a field of up to 31 bits. *)</div>
+ <div class="lineNone">000906| let construct_int_le_unsigned buf v flen exn =</div>
+ <div class="lineNone">000907| (* Check value is within range. *)</div>
+ <div class="lineAllUnvisited">000908| (*[0]*)if not (I.range_unsigned v flen) then (*[0]*)raise exn;</div>
+ <div class="lineNone">000909| (* Add the bytes. *)</div>
+ <div class="lineAllUnvisited">000910| (*[0]*)I.map_bytes_le (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
+ <div class="lineNone">000911| </div>
+ <div class="lineNone">000912| let construct_int_ne_unsigned =</div>
+ <div class="lineAllVisited">000913| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000914| then (*[0]*)construct_int_be_unsigned</div>
+ <div class="lineAllVisited">000915| else (*[34]*)construct_int_le_unsigned</div>
+ <div class="lineNone">000916| </div>
+ <div class="lineNone">000917| let construct_int_ee_unsigned = function</div>
+ <div class="lineAllUnvisited">000918| | BigEndian -> (*[0]*)construct_int_be_unsigned</div>
+ <div class="lineAllUnvisited">000919| | LittleEndian -> (*[0]*)construct_int_le_unsigned</div>
+ <div class="lineAllUnvisited">000920| | NativeEndian -> (*[0]*)construct_int_ne_unsigned</div>
+ <div class="lineNone">000921| </div>
+ <div class="lineNone">000922| (* Construct a field of exactly 32 bits. *)</div>
+ <div class="lineNone">000923| let construct_int32_be_unsigned buf v flen _ =</div>
<div class="lineAllVisited">000924| (*[6]*)Buffer.add_byte buf</div>
- <div class="lineNone">000925| (Int32.to_int ((Int32.logand (Int32.shift_right_logical v 16) 0xff_l)));</div>
+ <div class="lineNone">000925| (Int32.to_int (Int32.shift_right_logical v 24));</div>
<div class="lineAllVisited">000926| (*[6]*)Buffer.add_byte buf</div>
- <div class="lineAllVisited">000927| (*[6]*)(Int32.to_int ((Int32.logand (Int32.shift_right_logical v 8) 0xff_l)));</div>
+ <div class="lineNone">000927| (Int32.to_int ((Int32.logand (Int32.shift_right_logical v 16) 0xff_l)));</div>
<div class="lineAllVisited">000928| (*[6]*)Buffer.add_byte buf</div>
- <div class="lineNone">000929| (Int32.to_int (Int32.logand v 0xff_l))</div>
- <div class="lineNone">000930| </div>
- <div class="lineNone">000931| let construct_int32_le_unsigned buf v flen _ =</div>
- <div class="lineAllVisited">000932| (*[12]*)Buffer.add_byte buf</div>
- <div class="lineNone">000933| (Int32.to_int (Int32.logand v 0xff_l));</div>
+ <div class="lineAllVisited">000929| (*[6]*)(Int32.to_int ((Int32.logand (Int32.shift_right_logical v 8) 0xff_l)));</div>
+ <div class="lineAllVisited">000930| (*[6]*)Buffer.add_byte buf</div>
+ <div class="lineNone">000931| (Int32.to_int (Int32.logand v 0xff_l))</div>
+ <div class="lineNone">000932| </div>
+ <div class="lineNone">000933| let construct_int32_le_unsigned buf v flen _ =</div>
<div class="lineAllVisited">000934| (*[12]*)Buffer.add_byte buf</div>
- <div class="lineNone">000935| (Int32.to_int ((Int32.logand (Int32.shift_right_logical v 8) 0xff_l)));</div>
+ <div class="lineNone">000935| (Int32.to_int (Int32.logand v 0xff_l));</div>
<div class="lineAllVisited">000936| (*[12]*)Buffer.add_byte buf</div>
- <div class="lineAllVisited">000937| (*[12]*)(Int32.to_int ((Int32.logand (Int32.shift_right_logical v 16) 0xff_l)));</div>
+ <div class="lineNone">000937| (Int32.to_int ((Int32.logand (Int32.shift_right_logical v 8) 0xff_l)));</div>
<div class="lineAllVisited">000938| (*[12]*)Buffer.add_byte buf</div>
- <div class="lineNone">000939| (Int32.to_int (Int32.shift_right_logical v 24))</div>
- <div class="lineNone">000940| </div>
- <div class="lineNone">000941| let construct_int32_ne_unsigned =</div>
- <div class="lineAllVisited">000942| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000943| then (*[0]*)construct_int32_be_unsigned</div>
- <div class="lineAllVisited">000944| else (*[28]*)construct_int32_le_unsigned</div>
- <div class="lineNone">000945| </div>
- <div class="lineNone">000946| let construct_int32_ee_unsigned = function</div>
- <div class="lineAllVisited">000947| | BigEndian -> (*[6]*)construct_int32_be_unsigned</div>
- <div class="lineAllVisited">000948| | LittleEndian -> (*[6]*)construct_int32_le_unsigned</div>
- <div class="lineAllVisited">000949| | NativeEndian -> (*[6]*)construct_int32_ne_unsigned</div>
- <div class="lineNone">000950| </div>
- <div class="lineNone">000951| (* Construct a field of up to 64 bits. *)</div>
- <div class="lineNone">000952| let construct_int64_be_unsigned buf v flen exn =</div>
- <div class="lineNone">000953| (* Check value is within range. *)</div>
- <div class="lineMixed">000954| (*[351850]*)if not (I64.range_unsigned v flen) then (*[0]*)raise exn;</div>
- <div class="lineNone">000955| (* Add the bytes. *)</div>
- <div class="lineAllVisited">000956| (*[351850]*)I64.map_bytes_be (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
- <div class="lineNone">000957| </div>
- <div class="lineNone">000958| (* Construct a field of up to 64 bits. *)</div>
- <div class="lineNone">000959| let construct_int64_le_unsigned buf v flen exn =</div>
- <div class="lineNone">000960| (* Check value is within range. *)</div>
- <div class="lineAllUnvisited">000961| (*[0]*)if not (I64.range_unsigned v flen) then (*[0]*)raise exn;</div>
- <div class="lineNone">000962| (* Add the bytes. *)</div>
- <div class="lineAllUnvisited">000963| (*[0]*)I64.map_bytes_le (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
- <div class="lineNone">000964| </div>
- <div class="lineNone">000965| let construct_int64_ne_unsigned =</div>
- <div class="lineAllVisited">000966| (*[28]*)if nativeendian = BigEndian</div>
- <div class="lineAllUnvisited">000967| then (*[0]*)construct_int64_be_unsigned</div>
- <div class="lineNone">000968| else (*construct_int64_le_unsigned*)</div>
- <div class="lineAllUnvisited">000969| fun _ _ _ _ -> (*[0]*)failwith "construct_int64_le_unsigned"</div>
- <div class="lineNone">000970| </div>
- <div class="lineNone">000971| let construct_int64_ee_unsigned = function</div>
- <div class="lineAllUnvisited">000972| | BigEndian -> (*[0]*)construct_int64_be_unsigned</div>
- <div class="lineNone">000973| | LittleEndian -> (*construct_int64_le_unsigned*)</div>
- <div class="lineAllUnvisited">000974| (fun _ _ _ _ -> (*[0]*)failwith "construct_int64_le_unsigned")</div>
- <div class="lineAllUnvisited">000975| | NativeEndian -> (*[0]*)construct_int64_ne_unsigned</div>
- <div class="lineNone">000976| </div>
- <div class="lineNone">000977| (* Construct from a string of bytes, exact multiple of 8 bits</div>
- <div class="lineNone">000978| * in length of course.</div>
- <div class="lineNone">000979| *)</div>
- <div class="lineNone">000980| let construct_string buf str =</div>
- <div class="lineAllVisited">000981| (*[89505]*)let len = String.length str in</div>
- <div class="lineAllVisited">000982| (*[89505]*)Buffer.add_bits buf str (len lsl 3)</div>
- <div class="lineNone">000983| </div>
- <div class="lineNone">000984| (* Construct from a bitstring. *)</div>
- <div class="lineNone">000985| let construct_bitstring buf (data, off, len) =</div>
- <div class="lineNone">000986| (* Add individual bits until we get to the next byte boundary of</div>
- <div class="lineNone">000987| * the underlying string.</div>
- <div class="lineNone">000988| *)</div>
- <div class="lineAllVisited">000989| (*[1197537]*)let blen = 7 - ((off + 7) land 7) in</div>
- <div class="lineAllVisited">000990| (*[1197537]*)let blen = min blen len in</div>
- <div class="lineAllVisited">000991| (*[1197537]*)let rec loop off len blen =</div>
- <div class="lineAllVisited">000992| (*[1197537]*)if blen = 0 then ((*[1197537]*)off, len)</div>
- <div class="lineNone">000993| else (</div>
- <div class="lineAllUnvisited">000994| (*[0]*)let b = extract_bit data off len 1</div>
- <div class="lineNone">000995| and off = off + 1 and len = len + 1 in</div>
- <div class="lineAllUnvisited">000996| (*[0]*)Buffer.add_bit buf (*[0]*)b;</div>
- <div class="lineAllUnvisited">000997| (*[0]*)loop off len (blen-1)</div>
- <div class="lineNone">000998| )</div>
- <div class="lineNone">000999| in</div>
- <div class="lineAllVisited">001000| (*[1197537]*)let off, len = loop off len blen in</div>
- <div class="lineAllVisited">001001| (*[1197537]*)assert ((*[1197537]*)len = 0 || (off (*[1174272]*)land 7) = 0);</div>
- <div class="lineNone">001002| </div>
- <div class="lineNone">001003| (* Add the remaining 'len' bits. *)</div>
- <div class="lineAllVisited">001004| (*[1197537]*)let data =</div>
- <div class="lineNone">001005| let off = off lsr 3 in</div>
- <div class="lineNone">001006| (* XXX dangerous allocation *)</div>
- <div class="lineAllVisited">001007| (*[1197537]*)if off = 0 then (*[1197537]*)data</div>
- <div class="lineAllUnvisited">001008| else (*[0]*)String.sub data off (String.length data - off) in</div>
- <div class="lineNone">001009| </div>
- <div class="lineAllVisited">001010| (*[1197537]*)Buffer.add_bits buf data len</div>
+ <div class="lineAllVisited">000939| (*[12]*)(Int32.to_int ((Int32.logand (Int32.shift_right_logical v 16) 0xff_l)));</div>
+ <div class="lineAllVisited">000940| (*[12]*)Buffer.add_byte buf</div>
+ <div class="lineNone">000941| (Int32.to_int (Int32.shift_right_logical v 24))</div>
+ <div class="lineNone">000942| </div>
+ <div class="lineNone">000943| let construct_int32_ne_unsigned =</div>
+ <div class="lineAllVisited">000944| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000945| then (*[0]*)construct_int32_be_unsigned</div>
+ <div class="lineAllVisited">000946| else (*[34]*)construct_int32_le_unsigned</div>
+ <div class="lineNone">000947| </div>
+ <div class="lineNone">000948| let construct_int32_ee_unsigned = function</div>
+ <div class="lineAllVisited">000949| | BigEndian -> (*[6]*)construct_int32_be_unsigned</div>
+ <div class="lineAllVisited">000950| | LittleEndian -> (*[6]*)construct_int32_le_unsigned</div>
+ <div class="lineAllVisited">000951| | NativeEndian -> (*[6]*)construct_int32_ne_unsigned</div>
+ <div class="lineNone">000952| </div>
+ <div class="lineNone">000953| (* Construct a field of up to 64 bits. *)</div>
+ <div class="lineNone">000954| let construct_int64_be_unsigned buf v flen exn =</div>
+ <div class="lineNone">000955| (* Check value is within range. *)</div>
+ <div class="lineMixed">000956| (*[351850]*)if not (I64.range_unsigned v flen) then (*[0]*)raise exn;</div>
+ <div class="lineNone">000957| (* Add the bytes. *)</div>
+ <div class="lineAllVisited">000958| (*[351850]*)I64.map_bytes_be (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
+ <div class="lineNone">000959| </div>
+ <div class="lineNone">000960| (* Construct a field of up to 64 bits. *)</div>
+ <div class="lineNone">000961| let construct_int64_le_unsigned buf v flen exn =</div>
+ <div class="lineNone">000962| (* Check value is within range. *)</div>
+ <div class="lineAllUnvisited">000963| (*[0]*)if not (I64.range_unsigned v flen) then (*[0]*)raise exn;</div>
+ <div class="lineNone">000964| (* Add the bytes. *)</div>
+ <div class="lineAllUnvisited">000965| (*[0]*)I64.map_bytes_le (Buffer._add_bits buf) (Buffer.add_byte buf) v flen</div>
+ <div class="lineNone">000966| </div>
+ <div class="lineNone">000967| let construct_int64_ne_unsigned =</div>
+ <div class="lineAllVisited">000968| (*[34]*)if nativeendian = BigEndian</div>
+ <div class="lineAllUnvisited">000969| then (*[0]*)construct_int64_be_unsigned</div>
+ <div class="lineNone">000970| else (*construct_int64_le_unsigned*)</div>
+ <div class="lineAllUnvisited">000971| fun _ _ _ _ -> (*[0]*)failwith "construct_int64_le_unsigned"</div>
+ <div class="lineNone">000972| </div>
+ <div class="lineNone">000973| let construct_int64_ee_unsigned = function</div>
+ <div class="lineAllUnvisited">000974| | BigEndian -> (*[0]*)construct_int64_be_unsigned</div>
+ <div class="lineNone">000975| | LittleEndian -> (*construct_int64_le_unsigned*)</div>
+ <div class="lineAllUnvisited">000976| (fun _ _ _ _ -> (*[0]*)failwith "construct_int64_le_unsigned")</div>
+ <div class="lineAllUnvisited">000977| | NativeEndian -> (*[0]*)construct_int64_ne_unsigned</div>
+ <div class="lineNone">000978| </div>
+ <div class="lineNone">000979| (* Construct from a string of bytes, exact multiple of 8 bits</div>
+ <div class="lineNone">000980| * in length of course.</div>
+ <div class="lineNone">000981| *)</div>
+ <div class="lineNone">000982| let construct_string buf str =</div>
+ <div class="lineAllVisited">000983| (*[89505]*)let len = String.length str in</div>
+ <div class="lineAllVisited">000984| (*[89505]*)Buffer.add_bits buf str (len lsl 3)</div>
+ <div class="lineNone">000985| </div>
+ <div class="lineNone">000986| (* Construct from a bitstring. *)</div>
+ <div class="lineNone">000987| let construct_bitstring buf (data, off, len) =</div>
+ <div class="lineNone">000988| (* Add individual bits until we get to the next byte boundary of</div>
+ <div class="lineNone">000989| * the underlying string.</div>
+ <div class="lineNone">000990| *)</div>
+ <div class="lineAllVisited">000991| (*[1317766]*)let blen = 7 - ((off + 7) land 7) in</div>
+ <div class="lineAllVisited">000992| (*[1317766]*)let blen = min blen len in</div>
+ <div class="lineAllVisited">000993| (*[1317766]*)let rec loop off len blen =</div>
+ <div class="lineAllVisited">000994| (*[1317766]*)if blen = 0 then ((*[1317766]*)off, len)</div>
+ <div class="lineNone">000995| else (</div>
+ <div class="lineAllUnvisited">000996| (*[0]*)let b = extract_bit data off len 1</div>
+ <div class="lineNone">000997| and off = off + 1 and len = len + 1 in</div>
+ <div class="lineAllUnvisited">000998| (*[0]*)Buffer.add_bit buf (*[0]*)b;</div>
+ <div class="lineAllUnvisited">000999| (*[0]*)loop off len (blen-1)</div>
+ <div class="lineNone">001000| )</div>
+ <div class="lineNone">001001| in</div>
+ <div class="lineAllVisited">001002| (*[1317766]*)let off, len = loop off len blen in</div>
+ <div class="lineAllVisited">001003| (*[1317766]*)assert ((*[1317766]*)len = 0 || (off (*[1290965]*)land 7) = 0);</div>
+ <div class="lineNone">001004| </div>
+ <div class="lineNone">001005| (* Add the remaining 'len' bits. *)</div>
+ <div class="lineAllVisited">001006| (*[1317766]*)let data =</div>
+ <div class="lineNone">001007| let off = off lsr 3 in</div>
+ <div class="lineNone">001008| (* XXX dangerous allocation *)</div>
+ <div class="lineAllVisited">001009| (*[1317766]*)if off = 0 then (*[1317766]*)data</div>
+ <div class="lineAllUnvisited">001010| else (*[0]*)String.sub data off (String.length data - off) in</div>
<div class="lineNone">001011| </div>
- <div class="lineNone">001012| (*----------------------------------------------------------------------*)</div>
- <div class="lineNone">001013| (* Extract a string from a bitstring. *)</div>
- <div class="lineNone">001014| </div>
- <div class="lineNone">001015| let string_of_bitstring (data, off, len) =</div>
- <div class="lineAllVisited">001016| (*[63963]*)if off (*[63963]*)land 7 = 0 && len (*[8535]*)land 7 = 0 then</div>
- <div class="lineNone">001017| (* Easy case: everything is byte-aligned. *)</div>
- <div class="lineAllVisited">001018| (*[8022]*)String.sub data (off lsr 3) (len lsr 3)</div>
- <div class="lineNone">001019| else (</div>
- <div class="lineNone">001020| (* Bit-twiddling case. *)</div>
- <div class="lineAllVisited">001021| (*[55941]*)let strlen = (len + 7) lsr 3 in</div>
- <div class="lineAllVisited">001022| (*[55941]*)let str = String.make strlen '\000' in</div>
- <div class="lineAllVisited">001023| (*[55941]*)let rec loop data off len i =</div>
- <div class="lineAllVisited">001024| (*[305313]*)if len >= 8 then (</div>
- <div class="lineAllVisited">001025| (*[249372]*)let c = extract_char_unsigned data off len 8</div>
- <div class="lineNone">001026| and off = off + 8 and len = len - 8 in</div>
- <div class="lineAllVisited">001027| (*[249372]*)str.[i] (*[249372]*)<- Char.chr c;</div>
- <div class="lineAllVisited">001028| (*[249372]*)loop data off len (i+1)</div>
- <div class="lineAllVisited">001029| ) else (*[52179]*)if len > 0 then (</div>
- <div class="lineAllVisited">001030| (*[3762]*)let c = extract_char_unsigned data off len len in</div>
- <div class="lineAllVisited">001031| (*[3762]*)str.[i] <- Char.chr (c lsl (8-len))</div>
- <div class="lineNone">001032| )</div>
- <div class="lineNone">001033| in</div>
- <div class="lineAllVisited">001034| (*[55941]*)loop data off len (*[55941]*)0;</div>
- <div class="lineAllVisited">001035| (*[55941]*)str</div>
- <div class="lineNone">001036| )</div>
- <div class="lineNone">001037| </div>
- <div class="lineNone">001038| (* To channel. *)</div>
- <div class="lineNone">001039| </div>
- <div class="lineNone">001040| let bitstring_to_chan ((data, off, len) as bits) chan =</div>
- <div class="lineNone">001041| (* Fail if the bitstring length isn't a multiple of 8. *)</div>
- <div class="lineAllUnvisited">001042| (*[0]*)if len land 7 <> 0 then (*[0]*)invalid_arg "bitstring_to_chan";</div>
- <div class="lineNone">001043| </div>
- <div class="lineAllUnvisited">001044| (*[0]*)if off land 7 = 0 then</div>
- <div class="lineNone">001045| (* Easy case: string is byte-aligned. *)</div>
- <div class="lineAllUnvisited">001046| (*[0]*)output chan data (off lsr 3) (len lsr 3)</div>
- <div class="lineNone">001047| else (</div>
- <div class="lineNone">001048| (* Bit-twiddling case: reuse string_of_bitstring *)</div>
- <div class="lineAllUnvisited">001049| (*[0]*)let str = string_of_bitstring bits in</div>
- <div class="lineAllUnvisited">001050| (*[0]*)output_string chan str</div>
- <div class="lineNone">001051| )</div>
- <div class="lineNone">001052| </div>
- <div class="lineNone">001053| let bitstring_to_file bits filename =</div>
- <div class="lineAllUnvisited">001054| (*[0]*)let chan = open_out_bin filename in</div>
- <div class="lineAllUnvisited">001055| (*[0]*)try</div>
- <div class="lineAllUnvisited">001056| (*[0]*)bitstring_to_chan bits chan;</div>
- <div class="lineAllUnvisited">001057| (*[0]*)close_out chan</div>
- <div class="lineNone">001058| with exn -></div>
- <div class="lineAllUnvisited">001059| (*[0]*)close_out (*[0]*)chan;</div>
- <div class="lineAllUnvisited">001060| (*[0]*)raise exn</div>
- <div class="lineNone">001061| </div>
- <div class="lineNone">001062| (*----------------------------------------------------------------------*)</div>
- <div class="lineNone">001063| (* Display functions. *)</div>
- <div class="lineNone">001064| </div>
- <div class="lineNone">001065| let isprint c =</div>
- <div class="lineAllUnvisited">001066| (*[0]*)let c = Char.code c in</div>
- <div class="lineAllUnvisited">001067| (*[0]*)c (*[0]*)>= 32 && (*[0]*)c < 127</div>
+ <div class="lineAllVisited">001012| (*[1317766]*)Buffer.add_bits buf data len</div>
+ <div class="lineNone">001013| </div>
+ <div class="lineNone">001014| (* Concatenate bitstrings. *)</div>
+ <div class="lineNone">001015| let concat bs =</div>
+ <div class="lineAllVisited">001016| (*[40461]*)let buf = Buffer.create () in</div>
+ <div class="lineAllVisited">001017| (*[40461]*)List.iter (construct_bitstring buf) (*[40461]*)bs;</div>
+ <div class="lineAllVisited">001018| (*[40461]*)Buffer.contents buf</div>
+ <div class="lineNone">001019| </div>
+ <div class="lineNone">001020| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">001021| (* Extract a string from a bitstring. *)</div>
+ <div class="lineNone">001022| let string_of_bitstring (data, off, len) =</div>
+ <div class="lineAllVisited">001023| (*[73011]*)if off (*[73011]*)land 7 = 0 && len (*[16597]*)land 7 = 0 then</div>
+ <div class="lineNone">001024| (* Easy case: everything is byte-aligned. *)</div>
+ <div class="lineAllVisited">001025| (*[9037]*)String.sub data (off lsr 3) (len lsr 3)</div>
+ <div class="lineNone">001026| else (</div>
+ <div class="lineNone">001027| (* Bit-twiddling case. *)</div>
+ <div class="lineAllVisited">001028| (*[63974]*)let strlen = (len + 7) lsr 3 in</div>
+ <div class="lineAllVisited">001029| (*[63974]*)let str = String.make strlen '\000' in</div>
+ <div class="lineAllVisited">001030| (*[63974]*)let rec loop data off len i =</div>
+ <div class="lineAllVisited">001031| (*[326148]*)if len >= 8 then (</div>
+ <div class="lineAllVisited">001032| (*[262174]*)let c = extract_char_unsigned data off len 8</div>
+ <div class="lineNone">001033| and off = off + 8 and len = len - 8 in</div>
+ <div class="lineAllVisited">001034| (*[262174]*)str.[i] (*[262174]*)<- Char.chr c;</div>
+ <div class="lineAllVisited">001035| (*[262174]*)loop data off len (i+1)</div>
+ <div class="lineAllVisited">001036| ) else (*[52324]*)if len > 0 then (</div>
+ <div class="lineAllVisited">001037| (*[11650]*)let c = extract_char_unsigned data off len len in</div>
+ <div class="lineAllVisited">001038| (*[11650]*)str.[i] <- Char.chr (c lsl (8-len))</div>
+ <div class="lineNone">001039| )</div>
+ <div class="lineNone">001040| in</div>
+ <div class="lineAllVisited">001041| (*[63974]*)loop data off len (*[63974]*)0;</div>
+ <div class="lineAllVisited">001042| (*[63974]*)str</div>
+ <div class="lineNone">001043| )</div>
+ <div class="lineNone">001044| </div>
+ <div class="lineNone">001045| (* To channel. *)</div>
+ <div class="lineNone">001046| </div>
+ <div class="lineNone">001047| let bitstring_to_chan ((data, off, len) as bits) chan =</div>
+ <div class="lineNone">001048| (* Fail if the bitstring length isn't a multiple of 8. *)</div>
+ <div class="lineMixed">001049| (*[1]*)if len land 7 <> 0 then (*[0]*)invalid_arg "bitstring_to_chan";</div>
+ <div class="lineNone">001050| </div>
+ <div class="lineAllVisited">001051| (*[1]*)if off land 7 = 0 then</div>
+ <div class="lineNone">001052| (* Easy case: string is byte-aligned. *)</div>
+ <div class="lineAllVisited">001053| (*[1]*)output chan data (off lsr 3) (len lsr 3)</div>
+ <div class="lineNone">001054| else (</div>
+ <div class="lineNone">001055| (* Bit-twiddling case: reuse string_of_bitstring *)</div>
+ <div class="lineAllUnvisited">001056| (*[0]*)let str = string_of_bitstring bits in</div>
+ <div class="lineAllUnvisited">001057| (*[0]*)output_string chan str</div>
+ <div class="lineNone">001058| )</div>
+ <div class="lineNone">001059| </div>
+ <div class="lineNone">001060| let bitstring_to_file bits filename =</div>
+ <div class="lineAllUnvisited">001061| (*[0]*)let chan = open_out_bin filename in</div>
+ <div class="lineAllUnvisited">001062| (*[0]*)try</div>
+ <div class="lineAllUnvisited">001063| (*[0]*)bitstring_to_chan bits chan;</div>
+ <div class="lineAllUnvisited">001064| (*[0]*)close_out chan</div>
+ <div class="lineNone">001065| with exn -></div>
+ <div class="lineAllUnvisited">001066| (*[0]*)close_out (*[0]*)chan;</div>
+ <div class="lineAllUnvisited">001067| (*[0]*)raise exn</div>
<div class="lineNone">001068| </div>
- <div class="lineNone">001069| let hexdump_bitstring chan (data, off, len) =</div>
- <div class="lineAllUnvisited">001070| (*[0]*)let count = ref 0 in</div>
- <div class="lineAllUnvisited">001071| (*[0]*)let off = ref off in</div>
- <div class="lineAllUnvisited">001072| (*[0]*)let len = ref len in</div>
- <div class="lineAllUnvisited">001073| (*[0]*)let linelen = ref 0 in</div>
- <div class="lineAllUnvisited">001074| (*[0]*)let linechars = String.make 16 ' ' in</div>
- <div class="lineNone">001075| </div>
- <div class="lineAllUnvisited">001076| (*[0]*)fprintf chan "00000000 ";</div>
- <div class="lineNone">001077| </div>
- <div class="lineAllUnvisited">001078| (*[0]*)while !len > 0 do</div>
- <div class="lineAllUnvisited">001079| (*[0]*)let bits = min !len 8 in</div>
- <div class="lineAllUnvisited">001080| (*[0]*)let byte = extract_char_unsigned data !off !len bits in</div>
- <div class="lineAllUnvisited">001081| (*[0]*)off := !off + bits; (*[0]*)len (*[0]*):= !len - bits;</div>
- <div class="lineNone">001082| </div>
- <div class="lineAllUnvisited">001083| (*[0]*)let byte = byte lsl (8-bits) in</div>
- <div class="lineAllUnvisited">001084| (*[0]*)fprintf chan "%02x " byte;</div>
- <div class="lineNone">001085| </div>
- <div class="lineAllUnvisited">001086| (*[0]*)incr count;</div>
- <div class="lineAllUnvisited">001087| (*[0]*)linechars.[!linelen] <-</div>
- <div class="lineNone">001088| (let c = Char.chr byte in</div>
- <div class="lineAllUnvisited">001089| (*[0]*)if isprint c then (*[0]*)c else (*[0]*)'.');</div>
- <div class="lineAllUnvisited">001090| (*[0]*)incr linelen;</div>
- <div class="lineAllUnvisited">001091| (*[0]*)if !linelen = 8 then (*[0]*)fprintf chan " ";</div>
- <div class="lineAllUnvisited">001092| (*[0]*)if !linelen = 16 then (</div>
- <div class="lineAllUnvisited">001093| (*[0]*)fprintf chan " |%s|\n%08x " linechars !count;</div>
- <div class="lineAllUnvisited">001094| (*[0]*)linelen (*[0]*):= 0;</div>
- <div class="lineAllUnvisited">001095| (*[0]*)for i = 0 to 15 do (*[0]*)linechars.[i] <- ' ' done</div>
- <div class="lineNone">001096| )</div>
- <div class="lineNone">001097| done;</div>
- <div class="lineNone">001098| </div>
- <div class="lineAllUnvisited">001099| (*[0]*)if !linelen > 0 then (</div>
- <div class="lineAllUnvisited">001100| (*[0]*)let skip = (16 - !linelen) * 3 + if !linelen < 8 then (*[0]*)1 else (*[0]*)0 in</div>
- <div class="lineAllUnvisited">001101| (*[0]*)for i = 0 to skip-1 do (*[0]*)fprintf chan " " done;</div>
- <div class="lineAllUnvisited">001102| (*[0]*)fprintf chan " |%s|\n%!" linechars</div>
- <div class="lineNone">001103| ) else</div>
- <div class="lineAllUnvisited">001104| (*[0]*)fprintf chan "\n%!"</div>
+ <div class="lineNone">001069| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">001070| (* Comparison. *)</div>
+ <div class="lineNone">001071| let compare ((data1, off1, len1) as bs1) ((data2, off2, len2) as bs2) =</div>
+ <div class="lineNone">001072| (* In the fully-aligned case, this is reduced to string comparison ... *)</div>
+ <div class="lineAllVisited">001073| (*[4624]*)if off1 (*[4624]*)land 7 = 0 && len1 (*[4624]*)land 7 (*[4624]*)= 0 && off2 (*[680]*)land 7 (*[680]*)= 0 && len2 (*[535]*)land 7 = 0</div>
+ <div class="lineNone">001074| then (</div>
+ <div class="lineNone">001075| (* ... but we have to do that by hand because the bits may</div>
+ <div class="lineNone">001076| * not extend to the full length of the underlying string.</div>
+ <div class="lineNone">001077| *)</div>
+ <div class="lineAllVisited">001078| (*[100]*)let off1 = off1 lsr 3 and off2 = off2 lsr 3</div>
+ <div class="lineNone">001079| and len1 = len1 lsr 3 and len2 = len2 lsr 3 in</div>
+ <div class="lineAllVisited">001080| (*[100]*)let rec loop i =</div>
+ <div class="lineAllVisited">001081| (*[240]*)if (*[240]*)i < len1 && (*[170]*)i < len2 then (</div>
+ <div class="lineAllVisited">001082| (*[140]*)let c1 = String.unsafe_get data1 (off1 + i)</div>
+ <div class="lineNone">001083| and c2 = String.unsafe_get data2 (off2 + i) in</div>
+ <div class="lineAllVisited">001084| (*[140]*)let r = compare c1 c2 in</div>
+ <div class="lineMixed">001085| (*[140]*)if r <> 0 then (*[0]*)r</div>
+ <div class="lineAllVisited">001086| else (*[140]*)loop (i+1)</div>
+ <div class="lineNone">001087| )</div>
+ <div class="lineAllVisited">001088| else (*[100]*)len1 - len2</div>
+ <div class="lineNone">001089| in</div>
+ <div class="lineAllVisited">001090| (*[100]*)loop 0</div>
+ <div class="lineNone">001091| )</div>
+ <div class="lineNone">001092| else (</div>
+ <div class="lineNone">001093| (* Slow/unaligned. *)</div>
+ <div class="lineAllVisited">001094| (*[4524]*)let str1 = string_of_bitstring bs1</div>
+ <div class="lineNone">001095| and str2 = string_of_bitstring bs2 in</div>
+ <div class="lineAllVisited">001096| (*[4524]*)let r = String.compare str1 str2 in</div>
+ <div class="lineAllVisited">001097| (*[4524]*)if r <> 0 then (*[3058]*)r else (*[1466]*)len1 - len2</div>
+ <div class="lineNone">001098| )</div>
+ <div class="lineNone">001099| </div>
+ <div class="lineNone">001100| let equals ((_, _, len1) as bs1) ((_, _, len2) as bs2) =</div>
+ <div class="lineMixed">001101| (*[7]*)if len1 <> len2 then (*[0]*)false</div>
+ <div class="lineAllVisited">001102| else (*[7]*)if bs1 = bs2 then (*[7]*)true</div>
+ <div class="lineAllUnvisited">001103| else (*[0]*)0 = compare bs1 bs2</div>
+ <div class="lineNone">001104| </div>
+ <div class="lineNone">001105| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">001106| (* Bit get/set functions. *)</div>
+ <div class="lineNone">001107| </div>
+ <div class="lineAllUnvisited">001108| let index_out_of_bounds () = (*[0]*)invalid_arg "index out of bounds"</div>
+ <div class="lineNone">001109| </div>
+ <div class="lineNone">001110| let put (data, off, len) n v =</div>
+ <div class="lineAllUnvisited">001111| (*[0]*)if (*[0]*)n < 0 || (*[0]*)off+n >= len then (*[0]*)index_out_of_bounds ()</div>
+ <div class="lineNone">001112| else (</div>
+ <div class="lineAllUnvisited">001113| (*[0]*)let i = off+n in</div>
+ <div class="lineAllUnvisited">001114| (*[0]*)let si = i lsr 3 and mask = 0x80 lsr (i land 7) in</div>
+ <div class="lineAllUnvisited">001115| (*[0]*)let c = Char.code data.[si] in</div>
+ <div class="lineAllUnvisited">001116| (*[0]*)let c = if v <> 0 then c (*[0]*)lor mask else c (*[0]*)land (lnot mask) in</div>
+ <div class="lineAllUnvisited">001117| (*[0]*)data.[si] <- Char.unsafe_chr c</div>
+ <div class="lineNone">001118| )</div>
+ <div class="lineNone">001119| </div>
+ <div class="lineAllUnvisited">001120| let set bits n = (*[0]*)put bits n 1</div>
+ <div class="lineNone">001121| </div>
+ <div class="lineAllUnvisited">001122| let clear bits n = (*[0]*)put bits n 0</div>
+ <div class="lineNone">001123| </div>
+ <div class="lineNone">001124| let get (data, off, len) n =</div>
+ <div class="lineMixed">001125| (*[1945548]*)if (*[1945548]*)n < 0 || (*[1945548]*)off+n >= len then (*[0]*)index_out_of_bounds ()</div>
+ <div class="lineNone">001126| else (</div>
+ <div class="lineAllVisited">001127| (*[1945548]*)let i = off+n in</div>
+ <div class="lineAllVisited">001128| (*[1945548]*)let si = i lsr 3 and mask = 0x80 lsr (i land 7) in</div>
+ <div class="lineAllVisited">001129| (*[1945548]*)let c = Char.code data.[si] in</div>
+ <div class="lineAllVisited">001130| c (*[1945548]*)land mask</div>
+ <div class="lineNone">001131| )</div>
+ <div class="lineNone">001132| </div>
+ <div class="lineAllVisited">001133| let is_set bits n = (*[1297032]*)get bits n <> 0</div>
+ <div class="lineNone">001134| </div>
+ <div class="lineAllVisited">001135| let is_clear bits n = (*[648516]*)get bits n = 0</div>
+ <div class="lineNone">001136| </div>
+ <div class="lineNone">001137| (*----------------------------------------------------------------------*)</div>
+ <div class="lineNone">001138| (* Display functions. *)</div>
+ <div class="lineNone">001139| </div>
+ <div class="lineNone">001140| let isprint c =</div>
+ <div class="lineAllUnvisited">001141| (*[0]*)let c = Char.code c in</div>
+ <div class="lineAllUnvisited">001142| (*[0]*)c (*[0]*)>= 32 && (*[0]*)c < 127</div>
+ <div class="lineNone">001143| </div>
+ <div class="lineNone">001144| let hexdump_bitstring chan (data, off, len) =</div>
+ <div class="lineAllUnvisited">001145| (*[0]*)let count = ref 0 in</div>
+ <div class="lineAllUnvisited">001146| (*[0]*)let off = ref off in</div>
+ <div class="lineAllUnvisited">001147| (*[0]*)let len = ref len in</div>
+ <div class="lineAllUnvisited">001148| (*[0]*)let linelen = ref 0 in</div>
+ <div class="lineAllUnvisited">001149| (*[0]*)let linechars = String.make 16 ' ' in</div>
+ <div class="lineNone">001150| </div>
+ <div class="lineAllUnvisited">001151| (*[0]*)fprintf chan "00000000 ";</div>
+ <div class="lineNone">001152| </div>
+ <div class="lineAllUnvisited">001153| (*[0]*)while !len > 0 do</div>
+ <div class="lineAllUnvisited">001154| (*[0]*)let bits = min !len 8 in</div>
+ <div class="lineAllUnvisited">001155| (*[0]*)let byte = extract_char_unsigned data !off !len bits in</div>
+ <div class="lineAllUnvisited">001156| (*[0]*)off := !off + bits; (*[0]*)len (*[0]*):= !len - bits;</div>
+ <div class="lineNone">001157| </div>
+ <div class="lineAllUnvisited">001158| (*[0]*)let byte = byte lsl (8-bits) in</div>
+ <div class="lineAllUnvisited">001159| (*[0]*)fprintf chan "%02x " byte;</div>
+ <div class="lineNone">001160| </div>
+ <div class="lineAllUnvisited">001161| (*[0]*)incr count;</div>
+ <div class="lineAllUnvisited">001162| (*[0]*)linechars.[!linelen] <-</div>
+ <div class="lineNone">001163| (let c = Char.chr byte in</div>
+ <div class="lineAllUnvisited">001164| (*[0]*)if isprint c then (*[0]*)c else (*[0]*)'.');</div>
+ <div class="lineAllUnvisited">001165| (*[0]*)incr linelen;</div>
+ <div class="lineAllUnvisited">001166| (*[0]*)if !linelen = 8 then (*[0]*)fprintf chan " ";</div>
+ <div class="lineAllUnvisited">001167| (*[0]*)if !linelen = 16 then (</div>
+ <div class="lineAllUnvisited">001168| (*[0]*)fprintf chan " |%s|\n%08x " linechars !count;</div>
+ <div class="lineAllUnvisited">001169| (*[0]*)linelen (*[0]*):= 0;</div>
+ <div class="lineAllUnvisited">001170| (*[0]*)for i = 0 to 15 do (*[0]*)linechars.[i] <- ' ' done</div>
+ <div class="lineNone">001171| )</div>
+ <div class="lineNone">001172| done;</div>
+ <div class="lineNone">001173| </div>
+ <div class="lineAllUnvisited">001174| (*[0]*)if !linelen > 0 then (</div>
+ <div class="lineAllUnvisited">001175| (*[0]*)let skip = (16 - !linelen) * 3 + if !linelen < 8 then (*[0]*)1 else (*[0]*)0 in</div>
+ <div class="lineAllUnvisited">001176| (*[0]*)for i = 0 to skip-1 do (*[0]*)fprintf chan " " done;</div>
+ <div class="lineAllUnvisited">001177| (*[0]*)fprintf chan " |%s|\n%!" linechars</div>
+ <div class="lineNone">001178| ) else</div>
+ <div class="lineAllUnvisited">001179| (*[0]*)fprintf chan "\n%!"</div>
</code>
<hr class="codeSep"/>
- <p class="footer">Generated by <a href="http://bisect.x9c.fr">Bisect</a> on 2008-08-26 10:36:20</p>
+ <p class="footer">Generated by <a href="http://bisect.x9c.fr">Bisect</a> on 2008-08-26 17:29:02</p>
</body>
</html>