From 85bc3af88a1814a89d190a98fbaeab5df115fc6e Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 25 Sep 2018 13:19:50 +0200 Subject: [PATCH] Yet another fix of next_highest_power_of_2() on clang --- src/libslic3r/Utils.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index 98c15db3c..8feb17747 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -116,10 +116,12 @@ inline uint64_t next_highest_power_of_2(uint64_t v) // gives a duplicate symbol error. inline size_t next_highest_power_of_2(size_t v) { -#if sizeof(size_t) == sizeof(uint32_t) - return next_highest_power_of_2(uint32_t(v)); -#else +#if SSIZE_MAX == 9223372036854775807 + static_assert(sizeof(size_t) == sizeof(uint64_t)); return next_highest_power_of_2(uint64_t(v)); +#else + static_assert(sizeof(size_t) == sizeof(uint32_t)); + return next_highest_power_of_2(uint32_t(v)); #endif } #endif