3 ms·
The reason why struct packing would be a win is probably not performance, but code readability and less bugs. Making be/le/native conversion a job for the prog
by phkamp 15y ago
The reason why struct packing would be a win is probably not performance, but code readability and less bugs.
Making be/le/native conversion a job for the programmer is not only error-prone and a waste of time.
The compiler could safely optimize the byte-swizzles away on non-arithmetic operations, whereas most programmers tend to covert everything before they start working on it.
- __david__ 15y agoAlong those lines I wrote a wishful thinking, blue sky blog post a number of years ago: http://porkrind.org/missives/hardware-friendly-c-structures/ http://porkrind.org/missives/hardware-friendly-c-structures/