Print this page
5262 libm needs to be carefully unifdef'd
5268 libm doesn't need to hide symbols which are already local
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/common/m9x/frexpl.c
+++ new/usr/src/lib/libm/common/m9x/frexpl.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 -#if defined(ELFOBJ)
31 30 #pragma weak frexpl = __frexpl
32 -#endif
33 31
34 32 #include "libm.h"
35 33
36 34 #if defined(__sparc)
37 35
38 36 long double
39 37 __frexpl(long double x, int *exp) {
40 38 union {
41 39 unsigned i[4];
42 40 long double q;
43 41 } xx;
44 42 unsigned hx;
45 43 int e, s;
46 44
47 45 xx.q = x;
48 46 hx = xx.i[0] & ~0x80000000;
49 47
50 48 if (hx >= 0x7fff0000) { /* x is infinite or NaN */
51 49 *exp = 0;
52 50 return (x);
53 51 }
54 52
55 53 e = 0;
56 54 if (hx < 0x00010000) { /* x is subnormal or zero */
57 55 if ((hx | xx.i[1] | xx.i[2] | xx.i[3]) == 0) {
58 56 *exp = 0;
59 57 return (x);
60 58 }
61 59
62 60 /* normalize x */
63 61 s = xx.i[0] & 0x80000000;
64 62 while ((hx | (xx.i[1] & 0xffff0000)) == 0) {
65 63 hx = xx.i[1];
66 64 xx.i[1] = xx.i[2];
67 65 xx.i[2] = xx.i[3];
68 66 xx.i[3] = 0;
69 67 e -= 32;
70 68 }
71 69 while (hx < 0x10000) {
72 70 hx = (hx << 1) | (xx.i[1] >> 31);
73 71 xx.i[1] = (xx.i[1] << 1) | (xx.i[2] >> 31);
74 72 xx.i[2] = (xx.i[2] << 1) | (xx.i[3] >> 31);
75 73 xx.i[3] <<= 1;
76 74 e--;
77 75 }
78 76 xx.i[0] = s | hx;
79 77 }
80 78
81 79 /* now xx.q is normal */
82 80 xx.i[0] = (xx.i[0] & ~0x7fff0000) | 0x3ffe0000;
83 81 *exp = e + (hx >> 16) - 0x3ffe;
84 82 return (xx.q);
85 83 }
86 84
87 85 #elif defined(__x86)
88 86
89 87 long double
90 88 __frexpl(long double x, int *exp) {
91 89 union {
92 90 unsigned i[3];
93 91 long double e;
94 92 } xx;
95 93 unsigned hx;
96 94 int e;
97 95
98 96 xx.e = x;
99 97 hx = xx.i[2] & 0x7fff;
100 98
101 99 if (hx >= 0x7fff) { /* x is infinite or NaN */
102 100 *exp = 0;
103 101 return (x);
104 102 }
105 103
106 104 e = 0;
107 105 if (hx < 0x0001) { /* x is subnormal or zero */
108 106 if ((xx.i[0] | xx.i[1]) == 0) {
109 107 *exp = 0;
110 108 return (x);
111 109 }
112 110
113 111 /* normalize x */
114 112 xx.e *= 18446744073709551616.0L; /* 2^64 */
115 113 hx = xx.i[2] & 0x7fff;
116 114 e = -64;
117 115 }
118 116
119 117 /* now xx.e is normal */
120 118 xx.i[2] = (xx.i[2] & 0x8000) | 0x3ffe;
121 119 *exp = e + hx - 0x3ffe;
122 120 return (xx.e);
123 121 }
124 122
125 123 #else
126 124 #error Unknown architecture
127 125 #endif
↓ open down ↓ |
85 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX