diff --git a/src/build.clang.sh b/src/build.clang.sh new file mode 100755 index 0000000..b6f586d --- /dev/null +++ b/src/build.clang.sh @@ -0,0 +1 @@ +for i in *.c; do clang -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err diff --git a/src/build.gcc.sh b/src/build.gcc.sh new file mode 100755 index 0000000..ea7ca1b --- /dev/null +++ b/src/build.gcc.sh @@ -0,0 +1 @@ +for i in *.c; do gcc -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err diff --git a/src/e_fmodl.c b/src/e_fmodl.c index baa84e9..052cae8 100644 --- a/src/e_fmodl.c +++ b/src/e_fmodl.c @@ -16,7 +16,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" @@ -25,13 +25,13 @@ #if LDBL_MANL_SIZE > 32 typedef uint64_t manl_t; #else -typedef uint32_t manl_t; +typedef u_int32_t manl_t; #endif #if LDBL_MANH_SIZE > 32 typedef uint64_t manh_t; #else -typedef uint32_t manh_t; +typedef u_int32_t manh_t; #endif /* diff --git a/src/e_hypotl.c b/src/e_hypotl.c index f195f40..0a7b5c9 100644 --- a/src/e_hypotl.c +++ b/src/e_hypotl.c @@ -17,7 +17,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" @@ -42,7 +42,7 @@ #if LDBL_MANL_SIZE > 32 typedef uint64_t man_t; #else -typedef uint32_t man_t; +typedef u_int32_t man_t; #endif long double diff --git a/src/e_log10f.c b/src/e_log10f.c index b4b50d6..3656e02 100644 --- a/src/e_log10f.c +++ b/src/e_log10f.c @@ -20,6 +20,9 @@ #include "math_private.h" #include "k_logf.h" +// VBS +#define float_t float + static const float two25 = 3.3554432000e+07, /* 0x4c000000 */ ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */ diff --git a/src/e_log2f.c b/src/e_log2f.c index d5d3302..00df424 100644 --- a/src/e_log2f.c +++ b/src/e_log2f.c @@ -20,6 +20,9 @@ #include "math_private.h" #include "k_logf.h" +// VBS +#define float_t float + static const float two25 = 3.3554432000e+07, /* 0x4c000000 */ ivln2hi = 1.4428710938e+00, /* 0x3fb8b000 */ diff --git a/src/e_sqrtl.c b/src/e_sqrtl.c index cbf7fc3..7209ef4 100644 --- a/src/e_sqrtl.c +++ b/src/e_sqrtl.c @@ -30,7 +30,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" /* Return (x + ulp) for normal positive x. Assumes no overflow. */ diff --git a/src/k_exp.c b/src/k_exp.c index f91c5eb..32cbf38 100644 --- a/src/k_exp.c +++ b/src/k_exp.c @@ -32,7 +32,7 @@ #include "openlibm.h" #include "math_private.h" -static const uint32_t k = 1799; /* constant for reduction */ +static const u_int32_t k = 1799; /* constant for reduction */ static const double kln2 = 1246.97177782734161156; /* k * ln2 */ /* @@ -46,7 +46,7 @@ static double __frexp_exp(double x, int *expt) { double exp_x; - uint32_t hx; + u_int32_t hx; /* * We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to diff --git a/src/k_expf.c b/src/k_expf.c index 0776bb6..2addad4 100644 --- a/src/k_expf.c +++ b/src/k_expf.c @@ -32,7 +32,7 @@ #include "openlibm.h" #include "math_private.h" -static const uint32_t k = 235; /* constant for reduction */ +static const u_int32_t k = 235; /* constant for reduction */ static const float kln2 = 162.88958740F; /* k * ln2 */ /* @@ -45,7 +45,7 @@ static float __frexp_expf(float x, int *expt) { double exp_x; - uint32_t hx; + u_int32_t hx; exp_x = expf(x - kln2); GET_FLOAT_WORD(hx, exp_x); diff --git a/src/math_private.h b/src/math_private.h index b6f23e6..fbfa366 100644 --- a/src/math_private.h +++ b/src/math_private.h @@ -230,7 +230,7 @@ do { \ /* * Common routine to process the arguments to nan(), nanf(), and nanl(). */ -void _scan_nan(uint32_t *__words, int __num_words, const char *__s); +void _scan_nan(u_int32_t *__words, int __num_words, const char *__s); #ifdef _COMPLEX_H diff --git a/src/openlibm.h b/src/openlibm.h index 9c5a463..cc97996 100644 --- a/src/openlibm.h +++ b/src/openlibm.h @@ -34,6 +34,7 @@ extern const union __nan_un { float __uf; } __nan; +/* VBS #if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #define __MATH_BUILTIN_CONSTANTS #endif @@ -41,6 +42,10 @@ extern const union __nan_un { #if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER) #define __MATH_BUILTIN_RELOPS #endif +*/ + +#define __MATH_BUILTIN_CONSTANTS +#define __MATH_BUILTIN_RELOPS #ifdef __MATH_BUILTIN_CONSTANTS #define HUGE_VAL __builtin_huge_val() diff --git a/src/s_cbrtl.c b/src/s_cbrtl.c index a4b9930..8d59d0f 100644 --- a/src/s_cbrtl.c +++ b/src/s_cbrtl.c @@ -18,9 +18,10 @@ //__FBSDID("$FreeBSD: src/lib/msun/src/s_cbrtl.c,v 1.1 2011/03/12 19:37:35 kargl Exp $"); #include -#include +// VBS +//#include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" @@ -36,7 +37,7 @@ cbrtl(long double x) long double r, s, t, w; double dr, dt, dx; float ft, fx; - uint32_t hx; + u_int32_t hx; uint16_t expsign; int k; diff --git a/src/s_ceill.c b/src/s_ceill.c index a3bba31..b1c9f94 100644 --- a/src/s_ceill.c +++ b/src/s_ceill.c @@ -27,7 +27,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #ifdef LDBL_IMPLICIT_NBIT #define MANH_SIZE (LDBL_MANH_SIZE + 1) diff --git a/src/s_cexp.c b/src/s_cexp.c index 34acb43..7a7e03c 100644 --- a/src/s_cexp.c +++ b/src/s_cexp.c @@ -32,7 +32,7 @@ #include "math_private.h" -static const uint32_t +static const u_int32_t exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */ cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ @@ -40,7 +40,7 @@ double complex cexp(double complex z) { double x, y, exp_x; - uint32_t hx, hy, lx, ly; + u_int32_t hx, hy, lx, ly; x = creal(z); y = cimag(z); diff --git a/src/s_cexpf.c b/src/s_cexpf.c index 8782ddb..fd5649c 100644 --- a/src/s_cexpf.c +++ b/src/s_cexpf.c @@ -32,7 +32,7 @@ #include "math_private.h" -static const uint32_t +static const u_int32_t exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */ cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ @@ -40,7 +40,7 @@ float complex cexpf(float complex z) { float x, y, exp_x; - uint32_t hx, hy; + u_int32_t hx, hy; x = crealf(z); y = cimagf(z); diff --git a/src/s_copysignl.c b/src/s_copysignl.c index 5f164d9..b6f6f28 100644 --- a/src/s_copysignl.c +++ b/src/s_copysignl.c @@ -28,7 +28,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" long double copysignl(long double x, long double y) diff --git a/src/s_ctanh.c b/src/s_ctanh.c index d72ef7e..d92358f 100644 --- a/src/s_ctanh.c +++ b/src/s_ctanh.c @@ -76,7 +76,7 @@ ctanh(double complex z) { double x, y; double t, beta, s, rho, denom; - uint32_t hx, ix, lx; + u_int32_t hx, ix, lx; x = creal(z); y = cimag(z); diff --git a/src/s_ctanhf.c b/src/s_ctanhf.c index 41ea4bc..d0d60a7 100644 --- a/src/s_ctanhf.c +++ b/src/s_ctanhf.c @@ -41,7 +41,7 @@ ctanhf(float complex z) { float x, y; float t, beta, s, rho, denom; - uint32_t hx, ix; + u_int32_t hx, ix; x = crealf(z); y = cimagf(z); diff --git a/src/s_exp2.c b/src/s_exp2.c index 0844018..9090314 100644 --- a/src/s_exp2.c +++ b/src/s_exp2.c @@ -341,7 +341,7 @@ double exp2(double x) { double r, t, twopk, twopkp1000, z; - uint32_t hx, ix, lx, i0; + u_int32_t hx, ix, lx, i0; int k; /* Filter out exceptional cases. */ diff --git a/src/s_exp2f.c b/src/s_exp2f.c index 7894d48..1a20d7a 100644 --- a/src/s_exp2f.c +++ b/src/s_exp2f.c @@ -95,7 +95,7 @@ exp2f(float x) { double tv, twopk, u, z; float t; - uint32_t hx, ix, i0; + u_int32_t hx, ix, i0; int32_t k; /* Filter out exceptional cases. */ diff --git a/src/s_fabsl.c b/src/s_fabsl.c index d4e1a71..c4d1b44 100644 --- a/src/s_fabsl.c +++ b/src/s_fabsl.c @@ -30,7 +30,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" long double fabsl(long double x) diff --git a/src/s_floorl.c b/src/s_floorl.c index ce091b6..544c6f1 100644 --- a/src/s_floorl.c +++ b/src/s_floorl.c @@ -27,7 +27,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #ifdef LDBL_IMPLICIT_NBIT #define MANH_SIZE (LDBL_MANH_SIZE + 1) diff --git a/src/s_fmaf.c b/src/s_fmaf.c index 2d0f33b..a32382f 100644 --- a/src/s_fmaf.c +++ b/src/s_fmaf.c @@ -43,7 +43,7 @@ float fmaf(float x, float y, float z) { double xy, result; - uint32_t hr, lr; + u_int32_t hr, lr; xy = (double)x * y; result = xy + z; diff --git a/src/s_fmal.c b/src/s_fmal.c index 86206a2..729acb2 100644 --- a/src/s_fmal.c +++ b/src/s_fmal.c @@ -31,7 +31,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" /* * A struct dd represents a floating-point number with twice the precision diff --git a/src/s_fmax.c b/src/s_fmax.c index fea0708..9a3f164 100644 --- a/src/s_fmax.c +++ b/src/s_fmax.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" double fmax(double x, double y) diff --git a/src/s_fmaxf.c b/src/s_fmaxf.c index 7c22f3e..d8f87e0 100644 --- a/src/s_fmaxf.c +++ b/src/s_fmaxf.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" float fmaxf(float x, float y) diff --git a/src/s_fmaxl.c b/src/s_fmaxl.c index 959ae73..fefd00a 100644 --- a/src/s_fmaxl.c +++ b/src/s_fmaxl.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" long double fmaxl(long double x, long double y) diff --git a/src/s_fmin.c b/src/s_fmin.c index bfe8ca5..470b00f 100644 --- a/src/s_fmin.c +++ b/src/s_fmin.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" double fmin(double x, double y) diff --git a/src/s_fminf.c b/src/s_fminf.c index 868dc0f..1eb59d2 100644 --- a/src/s_fminf.c +++ b/src/s_fminf.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" float fminf(float x, float y) diff --git a/src/s_fminl.c b/src/s_fminl.c index 0530e3c..1563aa1 100644 --- a/src/s_fminl.c +++ b/src/s_fminl.c @@ -29,7 +29,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" long double fminl(long double x, long double y) diff --git a/src/s_frexpl.c b/src/s_frexpl.c index d550c77..b93ecce 100644 --- a/src/s_frexpl.c +++ b/src/s_frexpl.c @@ -29,7 +29,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" diff --git a/src/s_ilogbl.c b/src/s_ilogbl.c index 48da3c7..e65e12c 100644 --- a/src/s_ilogbl.c +++ b/src/s_ilogbl.c @@ -17,7 +17,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" int ilogbl(long double x) diff --git a/src/s_isfinite.c b/src/s_isfinite.c index 5103e9a..cb4ea17 100644 --- a/src/s_isfinite.c +++ b/src/s_isfinite.c @@ -28,7 +28,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" int __isfinite(double d) diff --git a/src/s_isnan.c b/src/s_isnan.c index aad7d22..1efeb81 100644 --- a/src/s_isnan.c +++ b/src/s_isnan.c @@ -28,7 +28,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" /* Provided by libc */ #if 0 diff --git a/src/s_isnormal.c b/src/s_isnormal.c index 741355b..2b624c3 100644 --- a/src/s_isnormal.c +++ b/src/s_isnormal.c @@ -28,7 +28,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" int __isnormal(double d) diff --git a/src/s_logbl.c b/src/s_logbl.c index fbbfa0e..059b423 100644 --- a/src/s_logbl.c +++ b/src/s_logbl.c @@ -18,7 +18,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_logbl.c,v 1.1 2007/12/17 03: #include #include -#include "fpopenlibm.h" +#include "fpmath.h" long double logbl(long double x) diff --git a/src/s_modfl.c b/src/s_modfl.c index daddd66..e5def7e 100644 --- a/src/s_modfl.c +++ b/src/s_modfl.c @@ -40,12 +40,12 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #if LDBL_MANL_SIZE > 32 #define MASK ((uint64_t)-1) #else -#define MASK ((uint32_t)-1) +#define MASK ((u_int32_t)-1) #endif /* Return the last n bits of a word, representing the fractional part. */ #define GETFRAC(bits, n) ((bits) & ~(MASK << (n))) diff --git a/src/s_nan.c b/src/s_nan.c index 6093377..b0a76e7 100644 --- a/src/s_nan.c +++ b/src/s_nan.c @@ -48,12 +48,12 @@ * impossible to use nan(3) portably anyway, so this seems good enough. */ void -_scan_nan(uint32_t *words, int num_words, const char *s) +_scan_nan(u_int32_t *words, int num_words, const char *s) { int si; /* index into s */ int bitpos; /* index into words (in bits) */ - bzero(words, num_words * sizeof(uint32_t)); + bzero(words, num_words * sizeof(u_int32_t)); /* Allow a leading '0x'. (It's expected, but redundant.) */ if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) @@ -80,7 +80,7 @@ nan(const char *s) { union { double d; - uint32_t bits[2]; + u_int32_t bits[2]; } u; _scan_nan(u.bits, 2, s); @@ -97,7 +97,7 @@ nanf(const char *s) { union { float f; - uint32_t bits[1]; + u_int32_t bits[1]; } u; _scan_nan(u.bits, 1, s); diff --git a/src/s_nextafterl.c b/src/s_nextafterl.c index f33f4bf..ed93558 100644 --- a/src/s_nextafterl.c +++ b/src/s_nextafterl.c @@ -22,7 +22,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" diff --git a/src/s_nexttoward.c b/src/s_nexttoward.c index 661599e..f919047 100644 --- a/src/s_nexttoward.c +++ b/src/s_nexttoward.c @@ -21,7 +21,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" diff --git a/src/s_nexttowardf.c b/src/s_nexttowardf.c index 82766b9..44ae507 100644 --- a/src/s_nexttowardf.c +++ b/src/s_nexttowardf.c @@ -14,7 +14,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" diff --git a/src/s_remquol.c b/src/s_remquol.c index f1218a4..4466337 100644 --- a/src/s_remquol.c +++ b/src/s_remquol.c @@ -16,7 +16,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #include "openlibm.h" #include "math_private.h" @@ -25,13 +25,13 @@ #if LDBL_MANL_SIZE > 32 typedef uint64_t manl_t; #else -typedef uint32_t manl_t; +typedef u_int32_t manl_t; #endif #if LDBL_MANH_SIZE > 32 typedef uint64_t manh_t; #else -typedef uint32_t manh_t; +typedef u_int32_t manh_t; #endif /* diff --git a/src/s_rintl.c b/src/s_rintl.c index 9272abc..1ab9672 100644 --- a/src/s_rintl.c +++ b/src/s_rintl.c @@ -30,7 +30,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #if LDBL_MAX_EXP != 0x4000 /* We also require the usual bias, min exp and expsign packing. */ @@ -55,7 +55,7 @@ long double rintl(long double x) { union IEEEl2bits u; - uint32_t expsign; + u_int32_t expsign; int ex, sign; u.e = x; diff --git a/src/s_scalbnl.c b/src/s_scalbnl.c index 55678dd..0b349e2 100644 --- a/src/s_scalbnl.c +++ b/src/s_scalbnl.c @@ -31,7 +31,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbnl.c,v 1.1 2005/03/07 0 #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" diff --git a/src/s_signbit.c b/src/s_signbit.c index 0946003..b07713a 100644 --- a/src/s_signbit.c +++ b/src/s_signbit.c @@ -28,7 +28,7 @@ #include -#include "fpopenlibm.h" +#include "fpmath.h" int __signbit(double d) diff --git a/src/s_truncl.c b/src/s_truncl.c index 9638155..03b15ea 100644 --- a/src/s_truncl.c +++ b/src/s_truncl.c @@ -27,7 +27,7 @@ #include #include -#include "fpopenlibm.h" +#include "fpmath.h" #ifdef LDBL_IMPLICIT_NBIT #define MANH_SIZE (LDBL_MANH_SIZE + 1)