summaryrefslogblamecommitdiff
path: root/src/string/swab.c
blob: 9ed6fcda9dee6ec83a33e4f0e1566ca80e2c7c2a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                   
                                                                     









                                 
#include <unistd.h>

void swab(const void *restrict _src, void *restrict _dest, ssize_t n)
{
	const char *src = _src;
	char *dest = _dest;
	for (; n>0; n-=2) {
		dest[0] = src[1];
		dest[1] = src[0];
		dest += 2;
		src += 2;
	}
}