Word and Endian classes for folding over Bits and Bytes
Haskell Community
Word and Endian classes for folding over Bits and Bytes
I was deciding whether I was going to write my virtual image data in either Little- or Big- Endian format, and while doing so, I reached for some trusty old friends that are useful for grabbing a specific byte out of an arbitrarily-sized byte-addressible word, and placing them side by side, refactoring them slightly to express their similarity: -- NOTE: Logical shifts in Bits use Little-Endian / LSB bit order -- They are unaffected by architecture endianness leByte :: (Integral i, Bits i) => In...
0 comments
No comments yet.