xref: /onnv-gate/usr/src/lib/libc/port/gen/l3.c (revision 6812:febeba71273d)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*6812Sraf  * Common Development and Distribution License (the "License").
6*6812Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*6812Sraf 
220Sstevel@tonic-gate /*
23*6812Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
30*6812Sraf #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate /*
330Sstevel@tonic-gate  * Convert longs to and from 3-byte disk addresses
340Sstevel@tonic-gate  */
35*6812Sraf #pragma weak _l3tol = l3tol
36*6812Sraf #pragma weak _ltol3 = ltol3
370Sstevel@tonic-gate 
38*6812Sraf #include "lint.h"
390Sstevel@tonic-gate 
400Sstevel@tonic-gate void
ltol3(char * cp,const long * lp,int n)410Sstevel@tonic-gate ltol3(char *cp, const long *lp, int n)
420Sstevel@tonic-gate {
430Sstevel@tonic-gate 	register i;
440Sstevel@tonic-gate 	register char *a, *b;
450Sstevel@tonic-gate 
460Sstevel@tonic-gate 	a = cp;
470Sstevel@tonic-gate 	b = (char *)lp;
480Sstevel@tonic-gate 	for (i = 0; i < n; ++i) {
490Sstevel@tonic-gate #if interdata || u370 || u3b || M32
500Sstevel@tonic-gate 		b++;
510Sstevel@tonic-gate 		*a++ = *b++;
520Sstevel@tonic-gate 		*a++ = *b++;
530Sstevel@tonic-gate 		*a++ = *b++;
540Sstevel@tonic-gate #endif
550Sstevel@tonic-gate #if vax || i286 || i386
560Sstevel@tonic-gate 		*a++ = *b++;
570Sstevel@tonic-gate 		*a++ = *b++;
580Sstevel@tonic-gate 		*a++ = *b++;
590Sstevel@tonic-gate 		b++;
600Sstevel@tonic-gate #endif
610Sstevel@tonic-gate #if pdp11
620Sstevel@tonic-gate 		*a++ = *b++;
630Sstevel@tonic-gate 		b++;
640Sstevel@tonic-gate 		*a++ = *b++;
650Sstevel@tonic-gate 		*a++ = *b++;
660Sstevel@tonic-gate #endif
670Sstevel@tonic-gate 	}
680Sstevel@tonic-gate }
690Sstevel@tonic-gate 
700Sstevel@tonic-gate void
l3tol(long * lp,const char * cp,int n)710Sstevel@tonic-gate l3tol(long *lp, const char *cp, int n)
720Sstevel@tonic-gate {
730Sstevel@tonic-gate 	register i;
740Sstevel@tonic-gate 	register char *a, *b;
750Sstevel@tonic-gate 
760Sstevel@tonic-gate 	a = (char *)lp;
770Sstevel@tonic-gate 	b = cp;
780Sstevel@tonic-gate 	for (i = 0; i < n; ++i) {
790Sstevel@tonic-gate #if interdata || u370 || u3b || M32
800Sstevel@tonic-gate 		*a++ = 0;
810Sstevel@tonic-gate 		*a++ = *b++;
820Sstevel@tonic-gate 		*a++ = *b++;
830Sstevel@tonic-gate 		*a++ = *b++;
840Sstevel@tonic-gate #endif
850Sstevel@tonic-gate #if vax || i286 || i386
860Sstevel@tonic-gate 		*a++ = *b++;
870Sstevel@tonic-gate 		*a++ = *b++;
880Sstevel@tonic-gate 		*a++ = *b++;
890Sstevel@tonic-gate 		*a++ = 0;
900Sstevel@tonic-gate #endif
910Sstevel@tonic-gate #if pdp11
920Sstevel@tonic-gate 		*a++ = *b++;
930Sstevel@tonic-gate 		*a++ = 0;
940Sstevel@tonic-gate 		*a++ = *b++;
950Sstevel@tonic-gate 		*a++ = *b++;
960Sstevel@tonic-gate #endif
970Sstevel@tonic-gate 	}
980Sstevel@tonic-gate }
99