Files
Arquivotheca.SunOS-4.1.4/xpglib/swab.c
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

37 lines
609 B
C

#if !defined(lint) && defined(SCCSIDS)
static char sccsid[] = "@(#)swab.c 1.1 94/10/31 SMI";
#endif
/* Xpg87 version of swab
* returns if length is negative
/*
* Copyright (C) 1989 by Sun Microsystems, Inc.
*/
/*
* Swab bytes
* Jeffrey Mogul, Stanford
*/
void
swab(from, to, n)
register char *from, *to;
register int n;
{
register unsigned long temp;
if (n < 0)
return;
n >>= 1; n++;
#define STEP temp = *from++,*to++ = *from++,*to++ = temp
/* round to multiple of 8 */
while ((--n) & 07)
STEP;
n >>= 3;
while (--n >= 0) {
STEP; STEP; STEP; STEP;
STEP; STEP; STEP; STEP;
}
}