26#ifndef __NESTEDSUMS_UTILS_H__
27#define __NESTEDSUMS_UTILS_H__
31#include "ginac/ginac.h"
44 n = (n & 0x7FFFFFFFU) << 1;
48 n = (n & 0x7FFFFFFFU) | 0x00000001U;
50 GINAC_ASSERT(n<0x80000000U);
55#if SIZEOF_VOID_P == SIZEOF_INT
56typedef unsigned int p_int;
57#elif SIZEOF_VOID_P == SIZEOF_LONG
58typedef unsigned long p_int;
59#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
60typedef unsigned long long p_int;
62typedef unsigned long p_int;
72 unsigned long l = n * 0x4f1bbcddL;
73 return (l & 0x7fffffffU) ^ (l >> 32);
74#elif SIZEOF_LONG_LONG >= 8
78 unsigned long long l = n * 0x4f1bbcddL;
79 return (l & 0x7fffffffU) ^ (l >> 32);
80#elif SIZEOF_LONG_DOUBLE > 8
84 const static long double golden_ratio = .618033988749894848204586834370;
85 long double m = golden_ratio * n;
86 return unsigned((m -
int(m)) * 0x80000000);
88#error "No 64 bit data type. You lose."
92static inline unsigned make_hash_seed(
const std::type_info& tinfo)
96 const void* mangled_name_ptr = (
const void*)tinfo.name();
Definition basic_letter.cc:35
unsigned rotate_left_31(unsigned n)
Definition utils.h:41
unsigned golden_ratio_hash(unsigned n)
Definition utils.h:66