Disabled constexpr for hashing functions.
This was incompatible with -Wc++98-c++11-compat on some platforms, due to local variables in the function. Change-Id: Idef510c2cefe944eef2e0656f5a219c2158063e6
This commit is contained in:
parent
407fb5d537
commit
ca68d8b043
|
@ -39,7 +39,7 @@ template<> struct FnvTraits<uint64_t> {
|
||||||
static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL;
|
static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1(const char *input) {
|
template<typename T> T HashFnv1(const char *input) {
|
||||||
T hash = FnvTraits<T>::kOffsetBasis;
|
T hash = FnvTraits<T>::kOffsetBasis;
|
||||||
for (const char *c = input; *c; ++c) {
|
for (const char *c = input; *c; ++c) {
|
||||||
hash *= FnvTraits<T>::kFnvPrime;
|
hash *= FnvTraits<T>::kFnvPrime;
|
||||||
|
@ -48,7 +48,7 @@ template<typename T> FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1(const char *input) {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1a(const char *input) {
|
template<typename T> T HashFnv1a(const char *input) {
|
||||||
T hash = FnvTraits<T>::kOffsetBasis;
|
T hash = FnvTraits<T>::kOffsetBasis;
|
||||||
for (const char *c = input; *c; ++c) {
|
for (const char *c = input; *c; ++c) {
|
||||||
hash ^= static_cast<unsigned char>(*c);
|
hash ^= static_cast<unsigned char>(*c);
|
||||||
|
@ -57,12 +57,12 @@ template<typename T> FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1a(const char *input)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> FLATBUFFERS_CONSTEXPR_CPP14 inline uint16_t HashFnv1<uint16_t>(const char *input) {
|
template <> inline uint16_t HashFnv1<uint16_t>(const char *input) {
|
||||||
uint32_t hash = HashFnv1<uint32_t>(input);
|
uint32_t hash = HashFnv1<uint32_t>(input);
|
||||||
return (hash >> 16) ^ (hash & 0xffff);
|
return (hash >> 16) ^ (hash & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> FLATBUFFERS_CONSTEXPR_CPP14 inline uint16_t HashFnv1a<uint16_t>(const char *input) {
|
template <> inline uint16_t HashFnv1a<uint16_t>(const char *input) {
|
||||||
uint32_t hash = HashFnv1a<uint32_t>(input);
|
uint32_t hash = HashFnv1a<uint32_t>(input);
|
||||||
return (hash >> 16) ^ (hash & 0xffff);
|
return (hash >> 16) ^ (hash & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue