From 86272bba7f74884f9e82e0207d7147f674fae796 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Wed, 21 Oct 2015 21:53:41 +0100 Subject: [PATCH] libc: add new swab.c file --- Library/libs/swab.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Library/libs/swab.c diff --git a/Library/libs/swab.c b/Library/libs/swab.c new file mode 100644 index 00000000..17f7235b --- /dev/null +++ b/Library/libs/swab.c @@ -0,0 +1,13 @@ +#include + +void swab(const void *from, void *to, ssize_t n) +{ + const uint8_t *f = from; + uint8_t *t = to; + n >>= 1; + while(n--) { + *t++ = f[1]; + *t++ = *f; + f += 2; + } +} -- 2.34.1