[Haskell-beginners] Bit Manipulation
daniel.rozycki at yale.edu
Thu May 20 15:36:02 EDT 2010
I am a newcomer to Haskell trying to manipulate data at the bit level. More
specifically, I am trying to calculate a seven-bit value and a nine-bit
value, concatenate the two values as a Word16, and put the result using
putWord16. I know that this sounds weird (because it totally is), but it is
required by the standard of a networking protocol that I am implementing.
The byte seems to be the atomic unit in Haskell, but I need to go subatomic.
Currently, I am storing the two values each as Word16s, bitshifting one of
them left by nine (using shift in the Data.Bits module), and then adding the
two. Is there a simpler and/or more elegant way of achieving this result?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners