From 3fa0b5aabbc606cb540f75338efea1190fbb44a1 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Wed, 21 Aug 2019 18:32:13 +0200 Subject: [PATCH] Fixed issue in Sylvan where large numbers were not recognized as powers of 2. __builtin_popcount only takes unsigned int as input, but not larger numbers (e.g. 2^33). We use bit operations instead now. --- resources/3rdparty/sylvan/src/sylvan_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/3rdparty/sylvan/src/sylvan_common.c b/resources/3rdparty/sylvan/src/sylvan_common.c index 71f748f8c..492eac6f5 100755 --- a/resources/3rdparty/sylvan/src/sylvan_common.c +++ b/resources/3rdparty/sylvan/src/sylvan_common.c @@ -276,7 +276,7 @@ static size_t table_min = 0, table_max = 0, cache_min = 0, cache_max = 0; static int is_power_of_two(size_t size) { - return __builtin_popcount(size) == 1 ? 1 : 0; + return (size != 0) && ((size & (size-1)) == 0); } void