43 #include "Teuchos_Assert.hpp"
44 #include "Teuchos_CompilerCodeTweakMacros.hpp"
46 using namespace Teuchos;
49 const int HashUtils::primeCount_ = 33;
50 const int HashUtils::primes_[]
51 = {11, 19, 37, 59, 101, 163, 271, 443, 733, 1187, 1907, 3061,
52 4919, 7759, 12379, 19543, 30841, 48487, 75989,
53 119089, 185971, 290347, 452027, 703657, 1093237,
54 1695781, 2627993, 4067599, 6290467, 9718019,
55 15000607, 23133937, 35650091};
58 int HashUtils::nextPrime(
int newCapacity)
62 "HashUtils::nextPrime() overflow");
64 for (
int i=0; i<primeCount_; i++)
66 if (newCapacity <= primes_[i])
74 "unexpected case in HashUtils::nextPrime()");
87 unsigned char *to =
reinterpret_cast<unsigned char *
>(&total);
89 for (
size_t i=0; i < len; i++){
99 size_t maxIntBeforeWrap = std::numeric_limits<int>::max();
101 total += maxIntBeforeWrap;
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
static int getHashCode(const unsigned char *a, size_t len)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Avoid warning about unreachable or missing return from function.
Utilities for generating hashcodes.