forked from osmocom/wireshark
Make sure CAPACITY() doesn't shift the 1 out of range.
Make the 1 we shift left the size of a size_t, so it'll only go out of range if the result couldn't possibly fit in a size_t. (That should also make the object of the shift unsigned, which may squelch some other complaints.) Not that the map is *likely* to be bigger than 4GB, but it should squelch some complaints from Visual Studio Code Analysis. Change-Id: I489bfe6b1d9d4329c267936d9106dbba4388c492 Reviewed-on: https://code.wireshark.org/review/26163 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
ac69a67112
commit
d4ef22db8f
|
@ -68,7 +68,7 @@ struct _wmem_map_t {
|
|||
|
||||
/* Macro for calculating the real capacity of the map by using a left-shift to
|
||||
* do the 2^x operation. */
|
||||
#define CAPACITY(MAP) ((size_t)(1 << (MAP)->capacity))
|
||||
#define CAPACITY(MAP) (((size_t)1) << (MAP)->capacity)
|
||||
|
||||
/* Efficient universal integer hashing:
|
||||
* https://en.wikipedia.org/wiki/Universal_hashing#Avoiding_modular_arithmetic
|
||||
|
|
Loading…
Reference in New Issue