Explicitely type XORFastHash

This commit is contained in:
Daniel J. Hofmann 2016-01-21 16:11:33 +01:00
parent f8b5e7e2c9
commit 2f42196fca

View File

@ -10,6 +10,8 @@
#include <random> #include <random>
#include <vector> #include <vector>
#include <cstdint>
namespace osrm namespace osrm
{ {
namespace util namespace util
@ -35,8 +37,8 @@ namespace util
*/ */
class XORFastHash class XORFastHash
{ // 65k entries { // 65k entries
std::array<unsigned short, (2 << 16)> table1; std::array<std::uint16_t, (2 << 16)> table1;
std::array<unsigned short, (2 << 16)> table2; std::array<std::uint16_t, (2 << 16)> table2;
public: public:
XORFastHash() XORFastHash()
@ -50,10 +52,10 @@ class XORFastHash
std::shuffle(begin(table2), end(table2), generator); std::shuffle(begin(table2), end(table2), generator);
} }
inline unsigned short operator()(const unsigned originalValue) const inline std::uint16_t operator()(const std::uint32_t originalValue) const
{ {
unsigned short lsb = ((originalValue)&0xffff); std::uint16_t lsb = ((originalValue)&0xffff);
unsigned short msb = (((originalValue) >> 16) & 0xffff); std::uint16_t msb = (((originalValue) >> 16) & 0xffff);
BOOST_ASSERT(lsb < table1.size()); BOOST_ASSERT(lsb < table1.size());
BOOST_ASSERT(msb < table2.size()); BOOST_ASSERT(msb < table2.size());