Fixed performance of halfvec

This commit is contained in:
Andrew Kane
2024-04-12 11:50:34 -07:00
parent 06d90fdc76
commit f64abe3aae
6 changed files with 240 additions and 233 deletions

View File

@@ -42,29 +42,6 @@ typedef struct HalfVector
} HalfVector;
HalfVector *InitHalfVector(int dim);
float HalfToFloat4(half num);
half Float4ToHalf(float num);
half Float4ToHalfUnchecked(float num);
int halfvec_cmp_internal(HalfVector * a, HalfVector * b);
static inline bool
HalfIsNan(half num)
{
#ifdef FLT16_SUPPORT
return isnan(num);
#else
return (num & 0x7C00) == 0x7C00 && (num & 0x7FFF) != 0x7C00;
#endif
}
static inline bool
HalfIsInf(half num)
{
#ifdef FLT16_SUPPORT
return isinf(num);
#else
return (num & 0x7FFF) == 0x7C00;
#endif
}
#endif