aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Poletti <poletti.marco@gmail.com>2020-10-24 09:06:54 -0700
committerMarco Poletti <poletti.marco@gmail.com>2020-10-24 09:06:54 -0700
commit125c4038df524c6e2fd802208b7119b27518bc26 (patch)
tree00e4939f301432756c35bee86b0367ec2d64cab1
parent928458857f4b85a0016c2d724486343b4660cb46 (diff)
downloadgoogle-fruit-125c4038df524c6e2fd802208b7119b27518bc26.tar.gz
Add a pair of parentheses so that a use of a "max" function in Fruit don't get expanded by a macro on Windows.
See https://github.com/google/fruit/issues/127.
-rw-r--r--include/fruit/impl/data_structures/semistatic_map.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/fruit/impl/data_structures/semistatic_map.h b/include/fruit/impl/data_structures/semistatic_map.h
index c5b4eb4..1ccb00a 100644
--- a/include/fruit/impl/data_structures/semistatic_map.h
+++ b/include/fruit/impl/data_structures/semistatic_map.h
@@ -46,8 +46,10 @@ private:
static constexpr unsigned char beta = 4;
+ // The parentheses around std::numeric_limits<NumBits>::max are needed to workaround an issue in Windows where
+ // max is defined as a macro by a common system header. See https://github.com/google/fruit/issues/127.
static_assert(
- std::numeric_limits<NumBits>::max() >= sizeof(Unsigned) * CHAR_BIT,
+ (std::numeric_limits<NumBits>::max)() >= sizeof(Unsigned) * CHAR_BIT,
"An unsigned char is not enough to contain the number of bits in your platform. Please report this issue.");
struct HashFunction {