Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Portability woes: Endianness and Alignment, Part 2 (fastcompression.blogspot.com)
27 points by tandemstrong on Nov 25, 2014 | hide | past | favorite | 2 comments


People should read Rob Pike's "The byte order fallacy," which was already discussed here: https://news.ycombinator.com/item?id=3796378

http://commandcenter.blogspot.com/2012/04/byte-order-fallacy...


I have a lot of respect for Rob Pike. Doing what he says guarantees correct operation in typical cases, when the memory is cacheable. If CPU arch doesn't support unaligned loads, the compiler must additionally be able to deduce pointer alignment or it's forced to generate separate loads.

However, if performance is important, doing what Pike says doesn't always make sense. The case discussed in the article in question is one those.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: