1 (* Test computed offsets when original_off <> 0.
8 let make_bits p i n j m k = (
9 let pad0 = ones_bitstring p in
10 let pad1 = ones_bitstring (n-8) in
11 let pad2 = ones_bitstring (m-n-8) in
13 pad0 : p : bitstring; (* will be skipped below *)
15 pad1 : n-8 : bitstring;
16 j : 8; (* this should be at offset(n) *)
17 pad2 : m-n-8 : bitstring;
18 k : 8 (* this should be at offset(m) *)
22 let test_bits bits p i n j m k =
23 (* Skip the 'p' padding bits so the match starts at a non-zero offset. *)
24 let bits = dropbits p bits in
29 k' : 8 : offset(m) } when i = i' && j = j' && k = k' -> () (* ok *)
31 failwith (sprintf "62_offset_padding: test_bits: failed %d %d %d %d %d %d"
38 List.iter (fun (i,j,k) -> test_bits (make_bits p i n j m k) p i n j m k)
39 [0x55, 0xaa, 0x33; 0x33, 0xaa, 0x55; 0x12, 0x34, 0x56]