3 ms·
The Linux user space API byte swap functions: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/swab.h https://git.ker
by matheusmoreira 2y ago
The Linux user space API byte swap functions:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/swab.h https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/byteorder/little_endian.h https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/byteorder/big_endian.h https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
https://github.com/torvalds/linux/blob/master/include/uapi/linux/swab.h https://github.com/torvalds/linux/blob/master/include/uapi/l...
https://github.com/torvalds/linux/blob/master/include/uapi/linux/byteorder/little_endian.h https://github.com/torvalds/linux/blob/master/include/uapi/l...
https://github.com/torvalds/linux/blob/master/include/uapi/linux/byteorder/big_endian.h https://github.com/torvalds/linux/blob/master/include/uapi/l...
They are quite similar if not equivalent to the code presented in this article. I assume people far smarter than me have run these things under sanitizers and found no issues. I mean, it's Linux.
#include <asm/byteorder.h>