10 return key & HASH_MASK;
14 return hashCode(
static_cast<int>(key));
18 return hashCode(
static_cast<int>(key));
22 return hashCode(
static_cast<int>(key));
26 return hashCode(
static_cast<int>(key));
30 return hashCode(
static_cast<int>(key));
34 return hashCode(
static_cast<int>(key));
38 return hashCode(
static_cast<int>(key));
43 return hashCode(
static_cast<unsigned long>(key));
49 return hashCode(
reinterpret_cast<uintptr_t
>(key));
52 int hashCode(
const char* base,
size_t numBytes) {
53 unsigned hash = HASH_SEED;
54 for (
size_t i = 0; i < numBytes; i++) {
55 hash = HASH_MULTIPLIER * hash + base[i];
65 return hashCode(str.data(), str.length());
69 return hashCode(
reinterpret_cast<const char*
>(&key),
sizeof(
double));
73 return hashCode(
reinterpret_cast<const char*
>(&key),
sizeof(
float));
77 return hashCode(
reinterpret_cast<const char*
>(&key),
sizeof(
long double));
int hashCode(int key)
Returns a hash code for the specified key, which is always a nonnegative integer.
This file contains prototype for the hashCode functions used in class HashMap.