Skip to content

Commit bf0a6d7

Browse files
committed
Revert "Fix compilation with icx 2025"
This reverts commit 6d4c539.
1 parent 6d4c539 commit bf0a6d7

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

openvkl/include/openvkl/VKLBackgroundUndefined.h

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,11 @@
33

44
#pragma once
55

6+
#include "ispc_cpp_interop.h"
7+
68
// A special value we use to distinguish an undefined field value. This could
79
// be the result of sampling out of bounds, or sampling at a position in bounds
810
// but not covered by any input data.
911
// This value is a quiet NaN.
12+
#define VKL_BACKGROUND_UNDEFINED floatbits(0xFFC068B5u)
1013

11-
#ifdef ISPC
12-
#define vkl_floatbits floatbits
13-
#else
14-
#if defined(__cplusplus)
15-
#include <cstdint>
16-
#include <cstring>
17-
using std::memcpy;
18-
#else
19-
#include <stdint.h>
20-
#include <string.h>
21-
#endif
22-
inline float vkl_floatbits(uint32_t bits)
23-
{
24-
float fval;
25-
memcpy(&fval, &bits, 4);
26-
return fval;
27-
}
28-
#endif
29-
30-
#define VKL_BACKGROUND_UNDEFINED vkl_floatbits(0xFFC068B5u)

openvkl/include/openvkl/ispc_cpp_interop.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,42 @@
7979

8080
#endif // defined(__cplusplus)
8181

82+
// -----------------------------------------------------------------------------
83+
// Standard library functions.
84+
// -----------------------------------------------------------------------------
85+
86+
#if defined(__cplusplus)
87+
88+
inline float floatbits(vkl_uint32 bits)
89+
{
90+
VKL_INTEROP_STATIC_ASSERT(sizeof(float) == sizeof(vkl_uint32),
91+
"Float is not 4 Bytes.");
92+
float fval = 0.f;
93+
reinterpret_cast<char *>(&fval)[0] = reinterpret_cast<const char *>(&bits)[0];
94+
reinterpret_cast<char *>(&fval)[1] = reinterpret_cast<const char *>(&bits)[1];
95+
reinterpret_cast<char *>(&fval)[2] = reinterpret_cast<const char *>(&bits)[2];
96+
reinterpret_cast<char *>(&fval)[3] = reinterpret_cast<const char *>(&bits)[3];
97+
return fval;
98+
}
99+
100+
inline vkl_uint32 intbits(float value)
101+
{
102+
VKL_INTEROP_STATIC_ASSERT(sizeof(float) == sizeof(vkl_uint32),
103+
"Float is not 4 Bytes.");
104+
vkl_uint32 ival = 0;
105+
reinterpret_cast<char *>(&ival)[0] =
106+
reinterpret_cast<const char *>(&value)[0];
107+
reinterpret_cast<char *>(&ival)[1] =
108+
reinterpret_cast<const char *>(&value)[1];
109+
reinterpret_cast<char *>(&ival)[2] =
110+
reinterpret_cast<const char *>(&value)[2];
111+
reinterpret_cast<char *>(&ival)[3] =
112+
reinterpret_cast<const char *>(&value)[3];
113+
return ival;
114+
}
115+
116+
#endif
117+
82118
// -----------------------------------------------------------------------------
83119
// Helpers for univary definitions.
84120
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)