Port from Daniel Dickman (didickman at gmail dot com) with a few tweaks
by me. ok dcoppa@
The ocaml-bitstring project adds Erlang-style bitstrings and matching
over bitstrings as a syntax extension and library for OCaml. You
can use this module to both parse and generate binary formats, files
and protocols. Bitstring handling is added as primitives to the
language, making it exceptionally simple to use and very powerful.
Bitstring handles integers, strings, sub-bitstrings, big-, little-
and native-endianness, signed and unsigned types, variable-width
fields, and fields with arbitrary bit alignment.