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