2.11BSD/src/lib/libc/pdp/compat-2.9/l3.c
/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)l3.c 2.3 (Berkeley) 1/25/87";
#endif LIBC_SCCS and not lint
/*
* Convert longs to 3-byte disk addresses
*/
ltol3(cp, lp, n)
char *cp;
long *lp;
int n;
{
register i;
register char *a, *b;
a = cp;
b = (char *)lp;
for(i=0; i<n; i++) {
#ifdef interdata
b++;
*a++ = *b++;
*a++ = *b++;
*a++ = *b++;
#else
*a++ = *b++;
b++;
*a++ = *b++;
*a++ = *b++;
#endif
}
}
/*
* Convert 3-byte disk addresses to longs
*/
l3tol(lp, cp, n)
long *lp;
char *cp;
int n;
{
register i;
register char *a, *b;
a = (char *)lp;
b = cp;
for(i=0; i<n; i++) {
#ifdef interdata
*a++ = 0;
*a++ = *b++;
*a++ = *b++;
*a++ = *b++;
#else
*a++ = *b++;
*a++ = 0;
*a++ = *b++;
*a++ = *b++;
#endif
}
}