···1313 mutable state : int;
1414}
15151616-let pp ppf t =
1717- Fmt.pf ppf "lfsr(%d, 0x%0*X)" t.width (t.width / 4) t.state
1616+let pp ppf t = Fmt.pf ppf "lfsr(%d, 0x%0*X)" t.width (t.width / 4) t.state
18171918let v ~taps ~seed ~width =
2019 if width < 1 || width > 62 then
+2-4
test/test_lfsr.ml
···101101 let t = Lfsr.ccsds_oid () in
102102 for _ = 1 to 1000 do
103103 let b = Lfsr.next_byte t in
104104- if b < 0 || b > 255 then
105105- Alcotest.failf "next_byte returned %d" b
104104+ if b < 0 || b > 255 then Alcotest.failf "next_byte returned %d" b
106105 done
107106108107(* 32-bit LFSR with maximal polynomial has period 2^32-1. Verify state
···111110 let t = Lfsr.ccsds_oid () in
112111 for i = 1 to 100_000 do
113112 ignore (Lfsr.step t);
114114- if Lfsr.state t = 0 then
115115- Alcotest.failf "state became zero at step %d" i
113113+ if Lfsr.state t = 0 then Alcotest.failf "state became zero at step %d" i
116114 done
117115118116(* {1 CCSDS TM frame randomizer test vectors}