boostorg / static_string

A fixed capacity dynamically sized string
http://boost.org/libs/static_string
Boost Software License 1.0
62 stars 29 forks source link

Warnings when compiling on 32 bits platform #46

Closed pendenaor closed 1 year ago

pendenaor commented 1 year ago

Having some warnings when compiling on 32 bits arm with GCC 7.3

static_string.hpp:6366:54: warning: left shift count >= width of type [-Wshift-count-overflow]
     std::size_t const m = (std::size_t(0xe9846af) << 32) + 0x9b1a615d;
                                                      ^~
static_string.hpp:6367:21: warning: right shift count >= width of type [-Wshift-count-overflow]
     seed ^= seed >> 32;
                     ^~
static_string.hpp:6369:21: warning: right shift count >= width of type [-Wshift-count-overflow]
     seed ^= seed >> 32;
                     ^~

Apparently, this code calculate a hash on 64 bits but std::size_t is only 32 bits on my platform. A further exploration indicate that this code won't be used in my case but is still be compiled. So, just noisy misleading warnings.