From: Alan Cox Date: Wed, 21 Oct 2015 20:53:41 +0000 (+0100) Subject: libc: add new swab.c file X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=86272bba7f74884f9e82e0207d7147f674fae796;p=FUZIX.git libc: add new swab.c file --- 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; + } +}