1*13426Ssam /* swab.c 4.2 83/06/27 */ 2*13426Ssam 31991Swnj /* 4*13426Ssam * Swab bytes 5*13426Ssam * Jeffrey Mogul, Stanford 61991Swnj */ 71991Swnj 8*13426Ssam swab(from, to, n) 9*13426Ssam register char *from, *to; 10*13426Ssam register int n; 111991Swnj { 12*13426Ssam register unsigned long temp; 13*13426Ssam 14*13426Ssam n >>= 1; n++; 15*13426Ssam #define STEP temp = *from++,*to++ = *from++,*to++ = temp 16*13426Ssam /* round to multiple of 8 */ 17*13426Ssam while ((--n) & 07) 18*13426Ssam STEP; 19*13426Ssam n >>= 3; 201991Swnj while (--n >= 0) { 21*13426Ssam STEP; STEP; STEP; STEP; 22*13426Ssam STEP; STEP; STEP; STEP; 231991Swnj } 241991Swnj } 25