mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
delete superfluous libc floor implementations
This commit is contained in:
parent
9ef4bdf234
commit
3124f700c7
@ -1,7 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
double floor(double x)
|
||||
{
|
||||
__asm__ ("frintm %d0, %d1" : "=w"(x) : "w"(x));
|
||||
return x;
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
float floorf(float x)
|
||||
{
|
||||
__asm__ ("frintm %s0, %s1" : "=w"(x) : "w"(x));
|
||||
return x;
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
#include "libm.h"
|
||||
|
||||
#if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1
|
||||
#define EPS DBL_EPSILON
|
||||
#elif FLT_EVAL_METHOD==2
|
||||
#define EPS LDBL_EPSILON
|
||||
#endif
|
||||
static const double_t toint = 1/EPS;
|
||||
|
||||
double floor(double x)
|
||||
{
|
||||
union {double f; uint64_t i;} u = {x};
|
||||
int e = u.i >> 52 & 0x7ff;
|
||||
double_t y;
|
||||
|
||||
if (e >= 0x3ff+52 || x == 0)
|
||||
return x;
|
||||
/* y = int(x) - x, where int(x) is an integer neighbor of x */
|
||||
if (u.i >> 63)
|
||||
y = x - toint + toint - x;
|
||||
else
|
||||
y = x + toint - toint - x;
|
||||
/* special case because of non-nearest rounding modes */
|
||||
if (e <= 0x3ff-1) {
|
||||
FORCE_EVAL(y);
|
||||
return u.i >> 63 ? -1 : 0;
|
||||
}
|
||||
if (y > 0)
|
||||
return x + y - 1;
|
||||
return x + y;
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
#include "libm.h"
|
||||
|
||||
float floorf(float x)
|
||||
{
|
||||
union {float f; uint32_t i;} u = {x};
|
||||
int e = (int)(u.i >> 23 & 0xff) - 0x7f;
|
||||
uint32_t m;
|
||||
|
||||
if (e >= 23)
|
||||
return x;
|
||||
if (e >= 0) {
|
||||
m = 0x007fffff >> e;
|
||||
if ((u.i & m) == 0)
|
||||
return x;
|
||||
FORCE_EVAL(x + 0x1p120f);
|
||||
if (u.i >> 31)
|
||||
u.i += m;
|
||||
u.i &= ~m;
|
||||
} else {
|
||||
FORCE_EVAL(x + 0x1p120f);
|
||||
if (u.i >> 31 == 0)
|
||||
u.i = 0;
|
||||
else if (u.i << 1)
|
||||
u.f = -1.0;
|
||||
}
|
||||
return u.f;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
#include "libm.h"
|
||||
|
||||
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
||||
long double floorl(long double x)
|
||||
{
|
||||
return floor(x);
|
||||
}
|
||||
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
|
||||
|
||||
static const long double toint = 1/LDBL_EPSILON;
|
||||
|
||||
long double floorl(long double x)
|
||||
{
|
||||
union ldshape u = {x};
|
||||
int e = u.i.se & 0x7fff;
|
||||
long double y;
|
||||
|
||||
if (e >= 0x3fff+LDBL_MANT_DIG-1 || x == 0)
|
||||
return x;
|
||||
/* y = int(x) - x, where int(x) is an integer neighbor of x */
|
||||
if (u.i.se >> 15)
|
||||
y = x - toint + toint - x;
|
||||
else
|
||||
y = x + toint - toint - x;
|
||||
/* special case because of non-nearest rounding modes */
|
||||
if (e <= 0x3fff-1) {
|
||||
FORCE_EVAL(y);
|
||||
return u.i.se >> 15 ? -1 : 0;
|
||||
}
|
||||
if (y > 0)
|
||||
return x + y - 1;
|
||||
return x + y;
|
||||
}
|
||||
#endif
|
||||
@ -1,15 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _ARCH_PWR5X
|
||||
|
||||
double floor(double x)
|
||||
{
|
||||
__asm__ ("frim %0, %1" : "=d"(x) : "d"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "../floor.c"
|
||||
|
||||
#endif
|
||||
@ -1,15 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _ARCH_PWR5X
|
||||
|
||||
float floorf(float x)
|
||||
{
|
||||
__asm__ ("frim %0, %1" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "../floorf.c"
|
||||
|
||||
#endif
|
||||
@ -1,15 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
#if defined(__HTM__) || __ARCH__ >= 9
|
||||
|
||||
double floor(double x)
|
||||
{
|
||||
__asm__ ("fidbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "../floor.c"
|
||||
|
||||
#endif
|
||||
@ -1,15 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
#if defined(__HTM__) || __ARCH__ >= 9
|
||||
|
||||
float floorf(float x)
|
||||
{
|
||||
__asm__ ("fiebra %0, 7, %1, 4" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "../floorf.c"
|
||||
|
||||
#endif
|
||||
@ -1,15 +0,0 @@
|
||||
#include <math.h>
|
||||
|
||||
#if defined(__HTM__) || __ARCH__ >= 9
|
||||
|
||||
long double floorl(long double x)
|
||||
{
|
||||
__asm__ ("fixbra %0, 7, %1, 4" : "=f"(x) : "f"(x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include "../floorl.c"
|
||||
|
||||
#endif
|
||||
@ -824,8 +824,6 @@ const src_files = [_][]const u8{
|
||||
"musl/src/malloc/replaced.c",
|
||||
"musl/src/math/aarch64/ceil.c",
|
||||
"musl/src/math/aarch64/ceilf.c",
|
||||
"musl/src/math/aarch64/floor.c",
|
||||
"musl/src/math/aarch64/floorf.c",
|
||||
"musl/src/math/aarch64/fma.c",
|
||||
"musl/src/math/aarch64/fmaf.c",
|
||||
"musl/src/math/aarch64/fmax.c",
|
||||
@ -915,9 +913,6 @@ const src_files = [_][]const u8{
|
||||
"musl/src/math/fdiml.c",
|
||||
"musl/src/math/finite.c",
|
||||
"musl/src/math/finitef.c",
|
||||
"musl/src/math/floor.c",
|
||||
"musl/src/math/floorf.c",
|
||||
"musl/src/math/floorl.c",
|
||||
"musl/src/math/fma.c",
|
||||
"musl/src/math/fmaf.c",
|
||||
"musl/src/math/fmal.c",
|
||||
@ -1092,8 +1087,6 @@ const src_files = [_][]const u8{
|
||||
"musl/src/math/pow_data.c",
|
||||
"musl/src/math/powerpc64/ceil.c",
|
||||
"musl/src/math/powerpc64/ceilf.c",
|
||||
"musl/src/math/powerpc64/floor.c",
|
||||
"musl/src/math/powerpc64/floorf.c",
|
||||
"musl/src/math/powerpc64/fma.c",
|
||||
"musl/src/math/powerpc64/fmaf.c",
|
||||
"musl/src/math/powerpc64/fmax.c",
|
||||
@ -1156,9 +1149,6 @@ const src_files = [_][]const u8{
|
||||
"musl/src/math/s390x/ceil.c",
|
||||
"musl/src/math/s390x/ceilf.c",
|
||||
"musl/src/math/s390x/ceill.c",
|
||||
"musl/src/math/s390x/floor.c",
|
||||
"musl/src/math/s390x/floorf.c",
|
||||
"musl/src/math/s390x/floorl.c",
|
||||
"musl/src/math/s390x/fma.c",
|
||||
"musl/src/math/s390x/fmaf.c",
|
||||
"musl/src/math/s390x/nearbyint.c",
|
||||
|
||||
@ -754,7 +754,6 @@ const libc_top_half_src_files = [_][]const u8{
|
||||
"musl/src/math/fdiml.c",
|
||||
"musl/src/math/finite.c",
|
||||
"musl/src/math/finitef.c",
|
||||
"musl/src/math/floorl.c",
|
||||
"musl/src/math/fma.c",
|
||||
"musl/src/math/fmaf.c",
|
||||
"musl/src/math/fmaxl.c",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user