Python3 friendly splitting
[llpp.git] / le / bo.ml
blobfb245a4409cf6fa01e683cf7a9de16a15ea2785a
1 let w8 s pos i = Bytes.set s pos (Char.chr (i land 0xff));;
2 let r8 s pos = Char.code (Bytes.get s pos);;
4 let ordermagic = 'l';;
6 let w16 s pos i =
7 w8 s pos i;
8 w8 s (pos+1) (i lsr 8)
9 ;;
11 let w32 s pos i =
12 w16 s pos i;
13 w16 s (pos+2) (i lsr 16)
16 let r16 s pos =
17 let rb pos1 = Char.code (Bytes.get s (pos + pos1)) in
18 (rb 0) lor ((rb 1) lsl 8)
21 let r16s s pos =
22 let i = r16 s pos in
23 i - ((i land 0x8000) lsl 1)
26 let r32 s pos =
27 let rb pos1 = Char.code (Bytes.get s (pos + pos1)) in
28 let l = (rb 0) lor ((rb 1) lsl 8)
29 and u = (rb 2) lor ((rb 3) lsl 8) in
30 (u lsl 16) lor l