Skip to content

Commit 2aa421a

Browse files
committed
Fix compilation with icx 2025
1 parent 007e2dc commit 2aa421a

File tree

2 files changed

+20
-39
lines changed

2 files changed

+20
-39
lines changed

openvkl/include/openvkl/VKLBackgroundUndefined.h

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

44
#pragma once
55

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

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: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -79,42 +79,6 @@
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-
11882
// -----------------------------------------------------------------------------
11983
// Helpers for univary definitions.
12084
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)