ntdll: Use the floor() implementation from the bundled musl library.
This commit is contained in:
parent
ef4cefe8fb
commit
0aa71bdec4
1 changed files with 0 additions and 29 deletions
|
@ -67,35 +67,6 @@ double CDECL fabs( double x )
|
|||
return u.f;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* floor (NTDLL.@)
|
||||
*
|
||||
* Based on musl: src/math/floorf.c
|
||||
*/
|
||||
double CDECL floor( double x )
|
||||
{
|
||||
union {double f; UINT64 i;} u = {x};
|
||||
int e = (int)(u.i >> 52 & 0x7ff) - 0x3ff;
|
||||
UINT64 m;
|
||||
|
||||
if (e >= 52)
|
||||
return x;
|
||||
if (e >= 0) {
|
||||
m = 0x000fffffffffffffULL >> e;
|
||||
if ((u.i & m) == 0)
|
||||
return x;
|
||||
if (u.i >> 63)
|
||||
u.i += m;
|
||||
u.i &= ~m;
|
||||
} else {
|
||||
if (u.i >> 63 == 0)
|
||||
return 0;
|
||||
else if (u.i << 1)
|
||||
return -1;
|
||||
}
|
||||
return u.f;
|
||||
}
|
||||
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && defined(__i386__)
|
||||
|
||||
#define FPU_DOUBLE(var) double var; \
|
||||
|
|
Loading…
Add table
Reference in a new issue