efficient / libcuckoo

A high-performance, concurrent hash table
Other
1.61k stars 275 forks source link

Silence MSVC 2015 complaint about potential truncation. #94

Closed toojays closed 6 years ago

toojays commented 6 years ago

Since e0eeb904 changed b_slot::pathcode from size_type to uint16_t, MSVC 2015 complains: 1>cuckoohash_map.hh(1457): warning C4267: 'initializing': conversion from 'size_t' to 'uint16_t', possible loss of data 1> cuckoohash_map.hh(1456): note: while compiling class template member function 'cuckoohash_map<rs::String,rs::metrics::Metric,rs::string::Hash,rs::string::IsEqual,rs::Allocator<std::pair<const rs::String,rs::metrics::Metric>>,4>::b_slot::b_slot(const unsigned int64,const unsigned int64,const int8_t)'

This arithmetic should in fact be safe - we use static assertions to ensure that pathcode will be big enough. To silence the compiler, this commit changes a couple of other types to uint16_t to match pathcode.

manugoyal commented 6 years ago

Great, thanks!