diff options
Diffstat (limited to 'src/libstddjb/uint16_reverse.c')
-rw-r--r-- | src/libstddjb/uint16_reverse.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstddjb/uint16_reverse.c b/src/libstddjb/uint16_reverse.c new file mode 100644 index 0000000..fedade1 --- /dev/null +++ b/src/libstddjb/uint16_reverse.c @@ -0,0 +1,14 @@ +/* ISC license. */ + +#include <skalibs/uint16.h> + +void uint16_reverse (char *s, unsigned int n) +{ + while (n--) + { + char c = s[0] ; + s[0] = s[1] ; + s[1] = c ; + s += 2 ; + } +} |