Commit 534edd4d authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

bitvect: Fix compilation on 32-bits hosts.

* src/misc/bitvect.cc: Conditionally declare fnv<8>, so that the C++
parser does not choke on 14695981039346656037UL when compiling on a
32bit host.  Problem observed with g++ 4.0.1 and 4.2.1 on Darwin.
parent 9ccdef9c
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
......@@ -26,6 +26,7 @@
#include <cmath>
#include <hashfunc.hh>
#include <cstring>
#include <climits>
namespace spot
{
......@@ -42,9 +43,20 @@ namespace spot
return n;
}
// Fowler–Noll–Vo hash parameters for 64bits
// Fowler-Noll-Vo hash parameters.
// Add specializations as needed.
template<int numbytes>
struct fnv
{
};
// Do not define the following if ULONG_MAX cannot
// hold a 64-bit value, otherwise the parser will
// choke when parsing the constants.
#if ULONG_MAX >> 31 >> 31 >> 1 > 0
// Fowler-Noll-Vo hash parameters for 64bits
template<>
struct fnv<8>
{
static unsigned long init()
{
......@@ -56,19 +68,20 @@ namespace spot
return 1099511628211UL;
}
};
#endif
// FowlerNollVo hash parameters for 32bits
// Fowler-Noll-Vo hash parameters for 32bits
template<>
struct fnv<4>
{
static unsigned int init()
static unsigned long init()
{
return 2166136261U;
return 2166136261UL;
}
static unsigned int prime()
static unsigned long prime()
{
return 16777619U;
return 16777619UL;
}
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment