2007-04-25 20:19:35 +02:00
|
|
|
#include "precompiled.h"
|
|
|
|
#include "posix.h"
|
|
|
|
|
2007-04-30 16:35:19 +02:00
|
|
|
#if CPU_IA32
|
2007-04-30 21:58:04 +02:00
|
|
|
# include "lib/sysdep/ia32/ia32_asm.h"
|
2007-04-30 16:35:19 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if !HAVE_C99_MATH
|
|
|
|
|
|
|
|
float rintf(float f)
|
|
|
|
{
|
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_rintf(f);
|
|
|
|
#else
|
|
|
|
return (float)(int)f;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
double rint(double d)
|
|
|
|
{
|
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_rint(d);
|
|
|
|
#else
|
|
|
|
return (double)(int)d;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float fminf(float a, float b)
|
|
|
|
{
|
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_fminf(a, b);
|
|
|
|
#else
|
|
|
|
return (a < b)? a : b;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
float fmaxf(float a, float b)
|
|
|
|
{
|
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_fmaxf(a, b);
|
|
|
|
#else
|
|
|
|
return (a > b)? a : b;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint fpclassifyd(double d)
|
|
|
|
{
|
2007-04-30 21:58:04 +02:00
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_fpclassifyd(d);
|
|
|
|
#else
|
2007-04-30 16:35:19 +02:00
|
|
|
// really sucky stub implementation; doesn't attempt to cover all cases.
|
|
|
|
|
|
|
|
if(d != d)
|
|
|
|
return FP_NAN;
|
|
|
|
else
|
|
|
|
return FP_NORMAL;
|
2007-04-30 21:58:04 +02:00
|
|
|
#endif
|
2007-04-30 16:35:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
uint fpclassifyf(float f)
|
|
|
|
{
|
2007-04-30 21:58:04 +02:00
|
|
|
#if CPU_IA32
|
|
|
|
return ia32_asm_fpclassifyf(f);
|
|
|
|
#else
|
|
|
|
const double d = (double)f;
|
|
|
|
return fpclassifyd(d);
|
|
|
|
#endif
|
2007-04-30 16:35:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // #if !HAVE_C99_MATH
|