3 ms·
arianvanp had the point of my question correct.
by jared314 14y ago
arianvanp had the point of my question correct.
- arianvanp 14y agoNow to answer your question: Yes some languages actually support this: http://www.erlang.org/documentation/doc-5.6/doc/programming_examples/bit_syntax.html http://www.erlang.org/documentation/doc-5.6/doc/programming_... http://hackage.haskell.org/packages/archive/binary-strict/0.4.8/doc/html/Data-Binary-Strict-BitGet.html http://hackage.haskell.org/packages/archive/binary-strict/0.... (I have no idea why this isn't a Functor nor an Applicative Functor, so this is a bad example. and I know 'language features' in pure functional programming is cheating, butm eh) http://en.wikipedia.org/wiki/Bit_field http://en.wikipedia.org/wiki/Bit_field -- BE WARNED. C bitfields might give you access to bits, but they're still aligned to the boundary of your system (DWORD boundary on x86 for example) e.g.: struct a { unsigned a: 13; unsigned b: 12; }; sizeof(struct a) => 4; in gcc they've got a flag to force structs to their actual bit size: struct a { ... }__attribute__((packed));