Explicitely type XORFastHash
This commit is contained in:
parent
f8b5e7e2c9
commit
2f42196fca
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user