implicit-conversion warning in wyhash.h, building 32-bit
snej opened this issue · comments
Jens Alfke commented
When compiling wyhash.h for i386 (32-bit), Clang reports an implicit conversion from 64- to 32-bit:
wyhash.h:89:25: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'long' [-Werror,-Wshorten-64-to-32]
else if (_likely_(len)){ a=_wyr3(p,(unsigned)len); b=0; }
~~~~~~~~~^~~~
wyhash.h:20:40: note: expanded from macro '_likely_'
#define _likely_(x) __builtin_expect(x,1)
~~~~~~~~~~~~~~~~ ^
I think this is due to the way __builtin_expect
works; it seems to be comparing len
with 1
without size promotion. It's easy to fix this by changing line 89 to:
else if (_likely_(len>0)){ a=_wyr3(p,(unsigned)len); b=0; }
王一 WangYi commented
Fixed.
Thank you very much!