/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <cstdint>
#include <cstring>
+#include <limits>
#include <string>
#include <tuple>
#include <type_traits>
inline uint32_t hsieh_hash32_buf(const void* buf, size_t len) {
// forcing signed char, since other platforms can use unsigned
- const signed char* s = reinterpret_cast<const signed char*>(buf);
+ const unsigned char* s = reinterpret_cast<const unsigned char*>(buf);
uint32_t hash = static_cast<uint32_t>(len);
uint32_t tmp;
size_t rem;
}
};
+template <>
+struct hasher<bool> {
+ size_t operator()(bool key) const {
+ // Make sure that all the output bits depend on the input.
+ return key ? std::numeric_limits<size_t>::max() : 0;
+ }
+};
+
template<> struct hasher<int32_t> {
size_t operator()(int32_t key) const {
return hash::jenkins_rev_mix32(uint32_t(key));