10 Int32.add (Int32.shift_left x 8) y
14 Sys.word_size - size - 1 in
18 parser [< n = byte >] ->
22 parser [< x = byte; y = byte >] ->
26 parser [< x = byte; y = byte; z = byte >] ->
30 parser [< x = byte; y = byte; z = byte; w = byte >] ->
31 List.fold_left (+++) 0l @@ List.map Int32.of_int [w;z;y;x]
33 let si8 s = s_extend 8 @@ ui8 s
34 let si16 s = s_extend 16 @@ ui16 s
35 let si24 s = s_extend 24 @@ ui24 s
39 match Stream.peek stream with
45 let rec read_u30 stream =
47 Int32.logor (Int32.shift_left x 7) (Int32.logand y 0x7Fl) in
48 match stream with parser
52 read_u30 stream +++ Int32.of_int n
54 raise (Stream.Error "invalid format")
59 f @@ BitsIn.of_stream s
68 parser [< decimal = float $ ui16; int = float $ ui16>] ->
69 int +. (decimal /. float 0x1_00_00)
72 parser [< decimal = float $ ui8; int = float $ ui8 >] ->
73 int +. (decimal /. float 0x1_00)
76 parser [< d = ui32 >] ->
81 parser [< x = of_int32 $ ui32; y = of_int32 $ ui32 >] ->
82 float_of_bits @@ logor (shift_left y 32) x
84 let rect s = bits s ~f:begin parser
85 [< n = ub 5; x_min = sb n; x_max = sb n; y_min = sb n; y_max = sb n>] ->
86 (x_min, x_max, y_min, y_max)