summaryrefslogtreecommitdiff
path: root/src/libstddjb/uint16_bswap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/uint16_bswap.c')
-rw-r--r--src/libstddjb/uint16_bswap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstddjb/uint16_bswap.c b/src/libstddjb/uint16_bswap.c
new file mode 100644
index 0000000..6ab96ed
--- /dev/null
+++ b/src/libstddjb/uint16_bswap.c
@@ -0,0 +1,9 @@
+/* ISC license. */
+
+#include <stdint.h>
+#include <skalibs/uint16.h>
+
+uint16_t uint16_bswap (uint16_t a)
+{
+ return (a & 0x00ffu) << 8 | (a & 0xff00u) >> 8 ;
+}