3 ms·
I agree that in an ideal world we should just write load code using byte loads and shifts. But in the world we live in, compilers only got the ability to recogn
by account42 6y ago
I agree that in an ideal world we should just write load code using byte loads and shifts. But in the world we live in, compilers only got the ability to recognize that and emit a bswap instead in relatively recent [0] versions (compared to the age of C). And the recognition can still depend on the exact pattern used. Also, debug builds will still emit the whole shift mess, which in some cases can be annoying.
[0] https://godbolt.org/z/jMbqT86jo https://godbolt.org/z/jMbqT86jo