Get a bunch of stuff to build with clang.

This commit is contained in:
Viral B. Shah 2011-12-31 00:25:58 +05:30
parent 9b7ae68a59
commit e4481ba487
6 changed files with 24 additions and 12 deletions

View file

@ -70,7 +70,11 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */
pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */
#endif #endif
static inline __always_inline int //VBS
//static inline __always_inline int
//__ieee754_rem_pio2l(long double x, long double *y)
static inline int
__ieee754_rem_pio2l(long double x, long double *y) __ieee754_rem_pio2l(long double x, long double *y)
{ {
union IEEEl2bits u,u1; union IEEEl2bits u,u1;

View file

@ -44,8 +44,11 @@ extern const union __nan_un {
#endif #endif
*/ */
//VBS begin
#define __MATH_BUILTIN_CONSTANTS #define __MATH_BUILTIN_CONSTANTS
#define __MATH_BUILTIN_RELOPS #define __MATH_BUILTIN_RELOPS
#define __ISO_C_VISIBLE 1999
//VBS end
#ifdef __MATH_BUILTIN_CONSTANTS #ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VAL __builtin_huge_val() #define HUGE_VAL __builtin_huge_val()
@ -129,8 +132,9 @@ extern const union __nan_un {
: (sizeof (x) == sizeof (double)) ? __signbit(x) \ : (sizeof (x) == sizeof (double)) ? __signbit(x) \
: __signbitl(x)) : __signbitl(x))
typedef __double_t double_t; //VBS
typedef __float_t float_t; //typedef __double_t double_t;
//typedef __float_t float_t;
#endif /* __ISO_C_VISIBLE >= 1999 */ #endif /* __ISO_C_VISIBLE >= 1999 */
/* /*

View file

@ -32,7 +32,7 @@
#ifdef LDBL_IMPLICIT_NBIT #ifdef LDBL_IMPLICIT_NBIT
#define MANH_SIZE (LDBL_MANH_SIZE + 1) #define MANH_SIZE (LDBL_MANH_SIZE + 1)
#define INC_MANH(u, c) do { \ #define INC_MANH(u, c) do { \
u_int64_t o = u.bits.manh; \ uint64_t o = u.bits.manh; \
u.bits.manh += (c); \ u.bits.manh += (c); \
if (u.bits.manh < o) \ if (u.bits.manh < o) \
u.bits.exp++; \ u.bits.exp++; \
@ -40,7 +40,7 @@
#else #else
#define MANH_SIZE LDBL_MANH_SIZE #define MANH_SIZE LDBL_MANH_SIZE
#define INC_MANH(u, c) do { \ #define INC_MANH(u, c) do { \
u_int64_t o = u.bits.manh; \ uint64_t o = u.bits.manh; \
u.bits.manh += (c); \ u.bits.manh += (c); \
if (u.bits.manh < o) { \ if (u.bits.manh < o) { \
u.bits.exp++; \ u.bits.exp++; \
@ -64,7 +64,7 @@ floorl(long double x)
(u.bits.manh | u.bits.manl) != 0) (u.bits.manh | u.bits.manl) != 0)
u.e = u.bits.sign ? -1.0 : 0.0; u.e = u.bits.sign ? -1.0 : 0.0;
} else { } else {
u_int64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1); uint64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1);
if (((u.bits.manh & m) | u.bits.manl) == 0) if (((u.bits.manh & m) | u.bits.manl) == 0)
return (x); /* x is integral */ return (x); /* x is integral */
if (u.bits.sign) { if (u.bits.sign) {
@ -81,14 +81,14 @@ floorl(long double x)
} }
} }
} else if (e < LDBL_MANT_DIG - 1) { } else if (e < LDBL_MANT_DIG - 1) {
u_int64_t m = (u_int64_t)-1 >> (64 - LDBL_MANT_DIG + e + 1); uint64_t m = (uint64_t)-1 >> (64 - LDBL_MANT_DIG + e + 1);
if ((u.bits.manl & m) == 0) if ((u.bits.manl & m) == 0)
return (x); /* x is integral */ return (x); /* x is integral */
if (u.bits.sign) { if (u.bits.sign) {
if (e == MANH_SIZE - 1) if (e == MANH_SIZE - 1)
INC_MANH(u, 1); INC_MANH(u, 1);
else { else {
u_int64_t o = u.bits.manl; uint64_t o = u.bits.manl;
u.bits.manl += 1llu << (LDBL_MANT_DIG - e - 1); u.bits.manl += 1llu << (LDBL_MANT_DIG - e - 1);
if (u.bits.manl < o) /* got a carry */ if (u.bits.manl < o) /* got a carry */
INC_MANH(u, 1); INC_MANH(u, 1);

View file

@ -25,7 +25,10 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/limits.h> //VBS begin
//#include <sys/limits.h>
#include <limits.h>
//VBS end
#include <fenv.h> #include <fenv.h>
#include <openlibm.h> #include <openlibm.h>

View file

@ -26,7 +26,8 @@
* $FreeBSD: src/lib/msun/src/s_nan.c,v 1.2 2007/12/18 23:46:32 das Exp $ * $FreeBSD: src/lib/msun/src/s_nan.c,v 1.2 2007/12/18 23:46:32 das Exp $
*/ */
#include <sys/endian.h> //VBS
//#include <sys/endian.h>
#include <ctype.h> #include <ctype.h>
#include <float.h> #include <float.h>
#include <openlibm.h> #include <openlibm.h>

View file

@ -49,7 +49,7 @@ truncl(long double x)
if (huge + x > 0.0) if (huge + x > 0.0)
u.e = zero[u.bits.sign]; u.e = zero[u.bits.sign];
} else { } else {
u_int64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1); uint64_t m = ((1llu << MANH_SIZE) - 1) >> (e + 1);
if (((u.bits.manh & m) | u.bits.manl) == 0) if (((u.bits.manh & m) | u.bits.manl) == 0)
return (x); /* x is integral */ return (x); /* x is integral */
if (huge + x > 0.0) { /* raise inexact flag */ if (huge + x > 0.0) { /* raise inexact flag */
@ -58,7 +58,7 @@ truncl(long double x)
} }
} }
} else if (e < LDBL_MANT_DIG - 1) { } else if (e < LDBL_MANT_DIG - 1) {
u_int64_t m = (u_int64_t)-1 >> (64 - LDBL_MANT_DIG + e + 1); uint64_t m = (uint64_t)-1 >> (64 - LDBL_MANT_DIG + e + 1);
if ((u.bits.manl & m) == 0) if ((u.bits.manl & m) == 0)
return (x); /* x is integral */ return (x); /* x is integral */
if (huge + x > 0.0) /* raise inexact flag */ if (huge + x > 0.0) /* raise inexact flag */