From c57a86ce6264a4b141dfb462964e4dad3c1b154c Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Fri, 10 Sep 2021 16:34:38 +0300 Subject: [PATCH] src: Fix undefined behaviour Cppcheck produces the following warnings: ``` shared_string.hh:27:49: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour shared_string.hh:27:49: error: Signed integer overflow for expression '1<<31'. ``` Fixes #4340 --- src/shared_string.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared_string.hh b/src/shared_string.hh index a2c0345a..8455a31e 100644 --- a/src/shared_string.hh +++ b/src/shared_string.hh @@ -24,7 +24,7 @@ struct StringData : UseMemoryDomain private: StringData(int len) : refcount(0), length(len) {} - static constexpr uint32_t interned_flag = 1 << 31; + static constexpr uint32_t interned_flag = 1u << 31; static constexpr uint32_t refcount_mask = ~interned_flag; struct PtrPolicy