CRC checksums (CRC-16, CRC-32, CRC-32C) for OCaml
0
fork

Configure Feed

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

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+25 -6
+18 -6
README.md
··· 29 29 30 30 ```ocaml 31 31 # Crc.has_hardware_crc;; 32 - - : bool = true (* on Apple Silicon / modern x86_64 *) 32 + - : bool = true 33 33 ``` 34 34 35 35 ## Usage ··· 46 46 Sub-range variants for bytes buffers: 47 47 48 48 ```ocaml 49 - let buf = Bytes.of_string "Hello, world!" in 50 - let crc16 = Crc.crc16_ccitt_bytes buf 0 5 in (* CRC of "Hello" *) 51 - let crc32c = Crc.crc32c_bytes buf 7 6 in (* CRC of "world!" *) 49 + let () = 50 + let buf = Bytes.of_string "Hello, world!" in 51 + Printf.printf "Hello: 0x%04X\n" (Crc.crc16_ccitt_bytes buf 0 5); 52 + Printf.printf "world!: 0x%08X\n" (Crc.crc32c_bytes buf 7 6) 52 53 ``` 53 54 54 - ## Install 55 + ## Installation 55 56 57 + Install with opam: 58 + 59 + ```sh 60 + $ opam install crc 56 61 ``` 57 - opam install crc 62 + 63 + If opam cannot find the package, it may not yet be released in the public 64 + `opam-repository`. Add the overlay repository, then install it: 65 + 66 + ```sh 67 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 68 + $ opam update 69 + $ opam install crc 58 70 ``` 59 71 60 72 ## Portability
+1
crc.opam
··· 12 12 "ocaml" {>= "4.14"} 13 13 "dune-configurator" 14 14 "alcotest" {with-test} 15 + "mdx" {with-test} 15 16 "alcobar" {with-test} 16 17 "odoc" {with-doc} 17 18 ]
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries crc))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name crc) 4 5 ··· 20 21 (ocaml (>= 4.14)) 21 22 dune-configurator 22 23 (alcotest :with-test) 24 + (mdx :with-test) 23 25 (alcobar :with-test)))