Files
goo-engine/build_files/build_environment/patches/imath_358.diff
T
Brecht Van Lommel 802ac5ba5a Build: Library updates for 4.1
Update libraries to match VFX platform 2024, and a few other upgrades to
latest versions.

boost 1.82.0
deflate 1.18 (new)
ffi 3.4.4
freeglut (deleted)
ispc 1.12.1
llvm 17.0.6
materialx 1.38.8
mesa 23.3.0
numpy 1.24.3
opencolorio 2.3.0
openexr 3.2.1
openimageio 2.5.6.0
opensubdiv 3.6.0
openvdb 11.0.0
osl 1.13.5.0 (now dynamic)
python 3.11.6
sqlite 3.42.0
sse2neon 0d6e9b3dd4
usd 23.11
vulkan 1.3.270
xm2 2.12.3

This only updates the build scripts, the precompiled libraries for each
platform will land over the coming weeks.

Ref #113157

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Co-authored-by: Campbell Barton <campbell@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/116420
2023-12-21 19:16:11 +01:00

22 lines
960 B
Diff

diff --git a/src/Imath/half.h b/src/Imath/half.h
index 84b349ab..828e0d82 100644
--- a/src/Imath/half.h
+++ b/src/Imath/half.h
@@ -328,8 +328,14 @@ imath_half_to_float (imath_half_bits_t h)
// other compilers may provide count-leading-zeros primitives,
// but we need the community to inform us of the variants
uint32_t lc;
-# if defined(_MSC_VER) && (_M_IX86 || _M_X64)
- lc = __lzcnt (hexpmant);
+# if defined(_MSC_VER)
+ // The direct intrinsic for this is __lznct, but that is not supported
+ // on older x86_64 hardware or ARM. Instead uses the bsr instruction
+ // and one additional subtraction. This assumes hexpmant != 0, for 0
+ // bsr and lznct would behave differently.
+ unsigned long bsr;
+ _BitScanReverse (&bsr, hexpmant);
+ lc = (31 - bsr);
# elif defined(__GNUC__) || defined(__clang__)
lc = (uint32_t) __builtin_clz (hexpmant);
# else