Conversation
|
Regarding the design decisions. The state of support by the different C libaries used:
So, it was just easier to provide a standard compliant one based on the builtins provided by both GCC and clang. |
This provides glibc, NetBSD, FreeBSD compatible endian.h header with a lean and simple API to convert between host byte order to little endian and big endian and the other way around.
|
Hello 🐴 Looks reasonable to me. A few questions / nitpicks:
|
I extended and documented the unit test.
I was actually hoping to do that. But that is a bit controversial and a bit of work. But if this gets in, PRs to replace the use of Note: We likely have to still ship In the very least, I could clean up
It seems the fixup improving the unit test solved this already, now the static test is green :)
While reviewing #20301 I noticed a bug in the byte order conversion. A quick peek in the related driver w5100 showed the same bug. My first reaction was "Y R U not using |
|
Thx :) |
Contribution description
This adds the libc
endian.hheader compatible with glibc / FreeBSD / NetBSD / musl / ...It is a standardized and lean API that provides basically the same features as
byteorder.h.Testing procedure
A unit test was added:
make BOARD=nrf52840dk -C tests/unittests tests-libc flash testtl;dr
Issues/PRs references
As follow up, the
byteorder.hcould be adapted to use this, which IMO would improve readability. But that may be somewhat subjective, so let's not add this here.