Skip to content

Commit d74f5dd

Browse files
committed
Fix build error on FreeBSD using ParticlesToLevelSet without attribute
Ensure Abs() is defined separately for size_t on all platforms that need it, not just macOS. Signed-off-by: Brecht Van Lommel <[email protected]>
1 parent 8548fad commit d74f5dd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

openvdb/openvdb/math/Math.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,11 @@ inline long double Abs(long double x) { return std::fabs(x); }
319319
inline uint32_t Abs(uint32_t i) { return i; }
320320
inline uint64_t Abs(uint64_t i) { return i; }
321321
inline bool Abs(bool b) { return b; }
322-
// On OSX size_t and uint64_t are different types
323-
#if defined(__APPLE__) || defined(MACOSX)
324-
inline size_t Abs(size_t i) { return i; }
325-
#endif
322+
// On systems like macOS and FreeBSD, size_t and uint64_t are different types
323+
template <typename T, typename std::enable_if<
324+
std::is_same<T, size_t>::value
325+
>::type* = nullptr>
326+
inline T Abs(T i) { return i; }
326327
//@}
327328

328329

0 commit comments

Comments
 (0)