Skip to content

Commit

Permalink
Add a pair of parentheses so that a use of a "max" function in Fruit …
Browse files Browse the repository at this point in the history
…don't get expanded by a macro on Windows.

See #127.
  • Loading branch information
poletti-marco committed Oct 24, 2020
1 parent 9284588 commit 125c403
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/fruit/impl/data_structures/semistatic_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class SemistaticMap {

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 {
Expand Down

0 comments on commit 125c403

Please sign in to comment.