1 /* swab.c 5.1 85/05/30 */ 2 3 /* 4 * Swab bytes 5 * Jeffrey Mogul, Stanford 6 */ 7 8 swab(from, to, n) 9 register char *from, *to; 10 register int n; 11 { 12 register unsigned long temp; 13 14 n >>= 1; n++; 15 #define STEP temp = *from++,*to++ = *from++,*to++ = temp 16 /* round to multiple of 8 */ 17 while ((--n) & 07) 18 STEP; 19 n >>= 3; 20 while (--n >= 0) { 21 STEP; STEP; STEP; STEP; 22 STEP; STEP; STEP; STEP; 23 } 24 } 25