Commit: 07d3a3962ac8abc667547e388a562ebaa9e57e7b Author: Leszek Godlewski Date: Mon Nov 28 19:39:49 2022 +0100 Branches: master https://developer.blender.org/rB07d3a3962ac8abc667547e388a562ebaa9e57e7b
Fix Cycles build in VS2022, use explicit two's complement in find_first_set() Compiling Cycles in Visual Studio 2022 yields the error: C4146: unary minus operator applied to unsigned type, result still unsigned Replacing it with explicit two's complement achieves the same result as signed negation but avoids the error. Differential Revision: https://developer.blender.org/D16616 =================================================================== M intern/cycles/util/math.h =================================================================== diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h index 078ed5d8aab..2eeb4aebd54 100644 --- a/intern/cycles/util/math.h +++ b/intern/cycles/util/math.h @@ -860,7 +860,7 @@ ccl_device_inline uint find_first_set(uint x) return (x != 0) ? ctz(x) + 1 : 0; #else # ifdef _MSC_VER - return (x != 0) ? (32 - count_leading_zeros(x & (-x))) : 0; + return (x != 0) ? (32 - count_leading_zeros(x & (~x + 1))) : 0; # else return __builtin_ffs(x); # endif _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
