Files
Digital-Research-Source-Code/CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/clib/swab.c
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

18 lines
346 B
C

/* swab - swap (hi/lo) bytes in an area of memory */
/* constructed to allow in-place swabs (fr==to) */
#include <portab.h>
WORD swab(fr,to,num) /* CLEAR FUNCTION ***********/
REG BYTE *fr;
REG BYTE *to;
REG WORD num;
{
REG BYTE t;
for( ; num>0; num -= 2, fr += 2, to += 2) {
t = fr[0];
to[0] = fr[1];
to[1] = t;
}
return(0);
}