Interesting, but surprising they didn't look at how Erlang bit syntax works. http://erlang.org/doc/programming_examples/bit_syntax.html
It's considerably more flexible, much more elegant, and (in Erlang) battle-tested.
I wrote an Erlang-inspired version of bitstrings for OCaml: https://people.redhat.com/~rjones/bitstring/html/Bitstring.h...