3 ms·
I wonder how many veteran C programmers (myself not included) would react with "d'oh, of course you should byte-align memory access" here...
by th0br0 11y ago
I wonder how many veteran C programmers (myself not included) would react with "d'oh, of course you should byte-align memory access" here...
- danieldk 11y agoI was the author of the digest-pure package ('author' is a big word, since it is an extremely small amount of code). I would like to mention that my goal was to make simple, pure, reference implementations of crc32 and adler32 in Haskell. The digest package already provided performant implementations of the same functions using zlib. In fact, it is pointed out in the description of the digest-pure package that you should use digest if you want performance. It turned out to be a useful exercise, since adler32 in digest gave incorrect checksums, due to initialization to 0 rather than 1: https://github.com/jkff/digest/pull/1 https://github.com/jkff/digest/pull/1 Anyway, thanks to Francesco Mazzoli for the really nice article!
- chowells 11y agoAll memory access is byte-aligned. That's the definition of "byte". :) Word-aligning, though - that's a different story.