1 #include <unistd.h> 2 3 #if __GNUC__ < 4 4 #define restrict 5 #endif 6 7 void swab(const void *restrict _src, void *restrict _dest, ssize_t n) 8 { 9 const char *src = _src; 10 char *dest = _dest; 11 for (; n>1; n-=2) { 12 dest[0] = src[1]; 13 dest[1] = src[0]; 14 dest += 2; 15 src += 2; 16 } 17 } 18