From ca68d8b0433e39d788aefcd4c01a93cadcdc43f4 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 11 Mar 2019 14:01:07 -0700 Subject: [PATCH] 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 --- include/flatbuffers/hash.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/flatbuffers/hash.h b/include/flatbuffers/hash.h index a97b23152..16536cb49 100644 --- a/include/flatbuffers/hash.h +++ b/include/flatbuffers/hash.h @@ -39,7 +39,7 @@ template<> struct FnvTraits { static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL; }; -template FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1(const char *input) { +template T HashFnv1(const char *input) { T hash = FnvTraits::kOffsetBasis; for (const char *c = input; *c; ++c) { hash *= FnvTraits::kFnvPrime; @@ -48,7 +48,7 @@ template FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1(const char *input) { return hash; } -template FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1a(const char *input) { +template T HashFnv1a(const char *input) { T hash = FnvTraits::kOffsetBasis; for (const char *c = input; *c; ++c) { hash ^= static_cast(*c); @@ -57,12 +57,12 @@ template FLATBUFFERS_CONSTEXPR_CPP14 T HashFnv1a(const char *input) return hash; } -template <> FLATBUFFERS_CONSTEXPR_CPP14 inline uint16_t HashFnv1(const char *input) { +template <> inline uint16_t HashFnv1(const char *input) { uint32_t hash = HashFnv1(input); return (hash >> 16) ^ (hash & 0xffff); } -template <> FLATBUFFERS_CONSTEXPR_CPP14 inline uint16_t HashFnv1a(const char *input) { +template <> inline uint16_t HashFnv1a(const char *input) { uint32_t hash = HashFnv1a(input); return (hash >> 16) ^ (hash & 0xffff); }