xref: /titanic_50/usr/src/lib/libc/port/gen/l3.c (revision cd3e933325e68e23516a196a8fea7f49b1e497c3)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1988 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Convert longs to and from 3-byte disk addresses
34  */
35 #pragma weak _l3tol = l3tol
36 #pragma weak _ltol3 = ltol3
37 
38 #include "lint.h"
39 
40 void
41 ltol3(char *cp, const long *lp, int n)
42 {
43 	register i;
44 	register char *a, *b;
45 
46 	a = cp;
47 	b = (char *)lp;
48 	for (i = 0; i < n; ++i) {
49 #if interdata || u370 || u3b || M32
50 		b++;
51 		*a++ = *b++;
52 		*a++ = *b++;
53 		*a++ = *b++;
54 #endif
55 #if vax || i286 || i386
56 		*a++ = *b++;
57 		*a++ = *b++;
58 		*a++ = *b++;
59 		b++;
60 #endif
61 #if pdp11
62 		*a++ = *b++;
63 		b++;
64 		*a++ = *b++;
65 		*a++ = *b++;
66 #endif
67 	}
68 }
69 
70 void
71 l3tol(long *lp, const char *cp, int n)
72 {
73 	register i;
74 	register char *a, *b;
75 
76 	a = (char *)lp;
77 	b = cp;
78 	for (i = 0; i < n; ++i) {
79 #if interdata || u370 || u3b || M32
80 		*a++ = 0;
81 		*a++ = *b++;
82 		*a++ = *b++;
83 		*a++ = *b++;
84 #endif
85 #if vax || i286 || i386
86 		*a++ = *b++;
87 		*a++ = *b++;
88 		*a++ = *b++;
89 		*a++ = 0;
90 #endif
91 #if pdp11
92 		*a++ = *b++;
93 		*a++ = 0;
94 		*a++ = *b++;
95 		*a++ = *b++;
96 #endif
97 	}
98 }
99