Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 20,46 ****
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak frexpl = __frexpl
#include "libm.h"
#if defined(__sparc)
-
long double
! __frexpl(long double x, int *exp) {
union {
unsigned i[4];
long double q;
} xx;
unsigned hx;
int e, s;
xx.q = x;
hx = xx.i[0] & ~0x80000000;
--- 20,48 ----
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak frexpl = __frexpl
#include "libm.h"
#if defined(__sparc)
long double
! __frexpl(long double x, int *exp)
! {
union {
unsigned i[4];
long double q;
} xx;
+
unsigned hx;
int e, s;
xx.q = x;
hx = xx.i[0] & ~0x80000000;
*** 49,97 ****
*exp = 0;
return (x);
}
e = 0;
if (hx < 0x00010000) { /* x is subnormal or zero */
if ((hx | xx.i[1] | xx.i[2] | xx.i[3]) == 0) {
*exp = 0;
return (x);
}
/* normalize x */
s = xx.i[0] & 0x80000000;
while ((hx | (xx.i[1] & 0xffff0000)) == 0) {
hx = xx.i[1];
xx.i[1] = xx.i[2];
xx.i[2] = xx.i[3];
xx.i[3] = 0;
e -= 32;
}
while (hx < 0x10000) {
hx = (hx << 1) | (xx.i[1] >> 31);
xx.i[1] = (xx.i[1] << 1) | (xx.i[2] >> 31);
xx.i[2] = (xx.i[2] << 1) | (xx.i[3] >> 31);
xx.i[3] <<= 1;
e--;
}
xx.i[0] = s | hx;
}
/* now xx.q is normal */
xx.i[0] = (xx.i[0] & ~0x7fff0000) | 0x3ffe0000;
*exp = e + (hx >> 16) - 0x3ffe;
return (xx.q);
}
-
#elif defined(__x86)
-
long double
! __frexpl(long double x, int *exp) {
union {
unsigned i[3];
long double e;
} xx;
unsigned hx;
int e;
xx.e = x;
hx = xx.i[2] & 0x7fff;
--- 51,103 ----
*exp = 0;
return (x);
}
e = 0;
+
if (hx < 0x00010000) { /* x is subnormal or zero */
if ((hx | xx.i[1] | xx.i[2] | xx.i[3]) == 0) {
*exp = 0;
return (x);
}
/* normalize x */
s = xx.i[0] & 0x80000000;
+
while ((hx | (xx.i[1] & 0xffff0000)) == 0) {
hx = xx.i[1];
xx.i[1] = xx.i[2];
xx.i[2] = xx.i[3];
xx.i[3] = 0;
e -= 32;
}
+
while (hx < 0x10000) {
hx = (hx << 1) | (xx.i[1] >> 31);
xx.i[1] = (xx.i[1] << 1) | (xx.i[2] >> 31);
xx.i[2] = (xx.i[2] << 1) | (xx.i[3] >> 31);
xx.i[3] <<= 1;
e--;
}
+
xx.i[0] = s | hx;
}
/* now xx.q is normal */
xx.i[0] = (xx.i[0] & ~0x7fff0000) | 0x3ffe0000;
*exp = e + (hx >> 16) - 0x3ffe;
return (xx.q);
}
#elif defined(__x86)
long double
! __frexpl(long double x, int *exp)
! {
union {
unsigned i[3];
long double e;
} xx;
+
unsigned hx;
int e;
xx.e = x;
hx = xx.i[2] & 0x7fff;
*** 100,109 ****
--- 106,116 ----
*exp = 0;
return (x);
}
e = 0;
+
if (hx < 0x0001) { /* x is subnormal or zero */
if ((xx.i[0] | xx.i[1]) == 0) {
*exp = 0;
return (x);
}
*** 117,125 ****
/* now xx.e is normal */
xx.i[2] = (xx.i[2] & 0x8000) | 0x3ffe;
*exp = e + hx - 0x3ffe;
return (xx.e);
}
-
#else
#error Unknown architecture
#endif
--- 124,131 ----