5 Apr
2023
5 Apr
'23
2:02 p.m.
On Wed, Apr 05, 2023 at 01:35:34PM +0200, Amadeusz Sławiński wrote:
It makes sense, as array access reads 8 bit value, you would need to access value using pointer instead. So instead of doing be32_to_cpu(test_buf[i]) you would need to do be32_to_cpu(*(test_buf + i)) if I didn't mess the pointer magic ;)
And then I'm not sure which is better, be32_to_cpup or be32_to_cpu.
The p variant works with unaligned pointers but might be slower if the architecture doesn't support unaligned access. For this application it probably doesn't matter either way.