Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2022-02-02 13:17:13 +0300
committerSergey Sharybin <sergey@blender.org>2022-02-09 16:45:39 +0300
commitd74bb7be1916744ae56347b49333eac22ebb7339 (patch)
tree62ce91633945c40a6fe8f390a797e10c75127ca4 /intern/cycles/util/math.h
parentd82384f7e1a0ae6fd3b27bb261a4cd671c9939ac (diff)
Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change: - No possible downcast of size_t to int when calculating motion steps. - Disambiguate call to min() which was for some reason considered ambiguous on 32bit platforms `min(int, unsigned int)`. On an implementation side the `min()` is defined for a fixed width integer type to disambiguate uint from size_t on 32bit platforms, and yet be able to use it for 32bit operands on 64bit platforms without upcast. Fixes 32bit platforms (such as i386) in Debian package build system. Differential Revision: https://developer.blender.org/D13992
Diffstat (limited to 'intern/cycles/util/math.h')
-rw-r--r--intern/cycles/util/math.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index 605a19aaef0..a580a21c28b 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -124,7 +124,12 @@ ccl_device_inline int min(int a, int b)
return (a < b) ? a : b;
}
-ccl_device_inline uint min(uint a, uint b)
+ccl_device_inline uint32_t min(uint32_t a, uint32_t b)
+{
+ return (a < b) ? a : b;
+}
+
+ccl_device_inline uint64_t min(uint64_t a, uint64_t b)
{
return (a < b) ? a : b;
}