CCSDS 131.4-B short block-length LDPC codes
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

mass replace Printf.sprintf/printf with Fmt.str/pr (merlint E200)

112 files across the monorepo. Printf.sprintf → Fmt.str,
Printf.printf → Fmt.pr for consistent formatting library usage.

+8 -8
+1 -1
fuzz/fuzz_short_ldpc.ml
··· 28 28 match Short_ldpc.decode ~max_iter:50 code_128 corrupted with 29 29 | Ok recovered -> 30 30 check_eq ~pp:pp_string (Bytes.to_string data) (Bytes.to_string recovered) 31 - | Error e -> fail (Printf.sprintf "decode failed: %s" e) 31 + | Error e -> fail (Fmt.str "decode failed: %s" e) 32 32 33 33 (** Fuzz test: decode arbitrary input. If it succeeds, the output must be 34 34 exactly 16 bytes (k=128 bits / 8). *)
+2 -2
lib/short_ldpc.ml
··· 256 256 let data_bits = Bytes.length data * 8 in 257 257 if data_bits < code.k then 258 258 invalid_arg 259 - (Printf.sprintf 259 + (Fmt.str 260 260 "Short_ldpc.encode: data too short, need %d bits (%d bytes), got %d \ 261 261 bits" 262 262 code.k ··· 297 297 let cw_bits = Bytes.length codeword * 8 in 298 298 if cw_bits < code.n then 299 299 Error 300 - (Printf.sprintf 300 + (Fmt.str 301 301 "Short_ldpc.decode: codeword too short, need %d bits (%d bytes), got \ 302 302 %d bits" 303 303 code.n
+5 -5
test/test_short_ldpc.ml
··· 55 55 Alcotest.(check string) 56 56 "roundtrip k=128" (Bytes.to_string data) 57 57 (Bytes.to_string recovered) 58 - | Error e -> Alcotest.fail (Printf.sprintf "decode k=128 failed: %s" e) 58 + | Error e -> Alcotest.fail (Fmt.str "decode k=128 failed: %s" e) 59 59 60 60 (* --- k=256 tests --- *) 61 61 ··· 72 72 Alcotest.(check string) 73 73 "roundtrip k=256" (Bytes.to_string data) 74 74 (Bytes.to_string recovered) 75 - | Error e -> Alcotest.fail (Printf.sprintf "decode k=256 failed: %s" e) 75 + | Error e -> Alcotest.fail (Fmt.str "decode k=256 failed: %s" e) 76 76 77 77 (* --- k=512 tests --- *) 78 78 ··· 89 89 Alcotest.(check string) 90 90 "roundtrip k=512" (Bytes.to_string data) 91 91 (Bytes.to_string recovered) 92 - | Error e -> Alcotest.fail (Printf.sprintf "decode k=512 failed: %s" e) 92 + | Error e -> Alcotest.fail (Fmt.str "decode k=512 failed: %s" e) 93 93 94 94 (* --- Error correction tests --- *) 95 95 ··· 160 160 Alcotest.(check string) 161 161 "all-zeros roundtrip" (Bytes.to_string data) 162 162 (Bytes.to_string recovered) 163 - | Error e -> Alcotest.fail (Printf.sprintf "all-zeros failed: %s" e) 163 + | Error e -> Alcotest.fail (Fmt.str "all-zeros failed: %s" e) 164 164 165 165 let test_all_ones_128 () = 166 166 let code = Short_ldpc.ccsds_128 in ··· 172 172 Alcotest.(check string) 173 173 "all-ones roundtrip" (Bytes.to_string data) 174 174 (Bytes.to_string recovered) 175 - | Error e -> Alcotest.fail (Printf.sprintf "all-ones failed: %s" e) 175 + | Error e -> Alcotest.fail (Fmt.str "all-ones failed: %s" e) 176 176 177 177 (* --- Wrong length rejection --- *) 178 178