From 6944c06dee5d58843be379f2c37f98b74c618354 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Wed, 15 Mar 2023 20:03:13 +0100 Subject: [PATCH] make LogTable always signed char MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit char is signed by default on x86 but unsigned on some arm platforms but the table needs to contain -1 and this leads to errors like this: src/component_types/base_packed_component.h: In static member function ‘static unsigned int BasePackedComponent::log2(unsigned int)’: src/component_types/base_packed_component.h:128:10: error: narrowing conversion of ‘-1’ from ‘int’ to ‘char’ inside { } [-Wnarrowing] --- src/component_types/base_packed_component.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component_types/base_packed_component.h b/src/component_types/base_packed_component.h index bbf39b0..551a85a 100644 --- a/src/component_types/base_packed_component.h +++ b/src/component_types/base_packed_component.h @@ -119,7 +119,7 @@ class BasePackedComponent { static unsigned log2(unsigned v){ // taken from // http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup - static const char LogTable256[256] = + static const signed char LogTable256[256] = { #define LT(n) n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,