Add my_isnanorinf.

This commit is contained in:
Henrik Rydgard 2013-11-12 13:38:14 +01:00
parent 21b63f56ff
commit 726471f665
2 changed files with 11 additions and 1 deletions

View File

@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
target=android-19
android.library=true

View File

@ -105,6 +105,16 @@ inline bool my_isnan(float f) {
return ((f2u.u & 0x7F800000) == 0x7F800000) && (f2u.u & 0x7FFFFF);
}
inline bool my_isnanorinf(float f) {
union {
float f;
uint32_t u;
} f2u;
f2u.f = f;
// NaNs have non-zero mantissa, infs have zero mantissa. That is, we just ignore the mantissa here.
return ((f2u.u & 0x7F800000) == 0x7F800000);
}
inline int is_even(float d) {
float int_part;
modff(d / 2.0f, &int_part);