Index: lib/libc/string/swab.c =================================================================== --- lib/libc/string/swab.c +++ lib/libc/string/swab.c @@ -43,20 +43,20 @@ void swab(const void * __restrict from, void * __restrict to, ssize_t len) { - unsigned long temp; - int n; - char *fp, *tp; + unsigned char temp; + const unsigned char *fp; + unsigned char *tp; - if (len <= 0) + if (len < 2) // needs to be at least 2 to work return; - n = len >> 1; - fp = (char *)from; - tp = (char *)to; + len >>= 1; + fp = (const unsigned char *)from; + tp = (unsigned char *)to; #define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp /* round to multiple of 8 */ - for (; n & 0x7; --n) + for (; len & 0x7; --len) STEP; - for (n >>= 3; n > 0; --n) { + for (len >>= 3; len; --len) { STEP; STEP; STEP; STEP; STEP; STEP; STEP; STEP; }