diff --git a/CMakeLists.txt b/CMakeLists.txt index ec043e4..c2fb3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) ## Establish project ## -project(rkcommon VERSION 1.15.1 LANGUAGES CXX) +project(rkcommon VERSION 1.15.2 LANGUAGES CXX) include(GNUInstallDirs) diff --git a/rkcommon/math/math.ih b/rkcommon/math/math.ih index fe94487..bd04a27 100644 --- a/rkcommon/math/math.ih +++ b/rkcommon/math/math.ih @@ -27,10 +27,21 @@ using int8 = int8_t; // Constants // ------------------------------------------------------------------ +#ifdef ISPC #define inf floatbits(0x7F800000) #define pos_inf floatbits(0x7F800000) #define neg_inf floatbits(0xFF800000) #define nan floatbits(0x7FBFFFFF) +#else +constexpr float floatbits(unsigned int a) +{ + return sycl::bit_cast(a); +} +constexpr float inf = floatbits(0x7F800000); +constexpr float pos_inf = floatbits(0x7F800000); +constexpr float neg_inf = floatbits(0xFF800000); +constexpr float nan = floatbits(0x7FBFFFFF); +#endif // smallest positive normal number 2^-126 ~ 1.17549435e-38 #define flt_min 0x1.0p-126f @@ -137,10 +148,6 @@ inline float nextafter(const float a, const float b) { return sycl::nextafter(a, b); } -inline float floatbits(unsigned int a) -{ - return sycl::bit_cast(a); -} inline unsigned int intbits(float a) { return sycl::bit_cast(a);