+/** @file hash_seed.h
+ *
+ * Type-specific hash seed. */
+
#ifndef GINAC_HASH_SEED_H
#define GINAC_HASH_SEED_H
+
+#include <typeinfo>
+#include <cstring>
+#include "crc32.h"
+#include "utils.h"
+#ifdef _WIN32
+#define GINAC_HASH_USE_MANGLED_NAME 1
+#endif
+namespace GiNaC
+{
/**
* We need a hash function which gives different values for objects of
* different types. Hence we need some unique integer for each type.
* collisions (and slower evaluation as a result), but being a bit slower
* is much better than being wrong.
*/
-#include <typeinfo>
-#include <cstring>
-#include "crc32.h"
-#include "utils.h"
-#ifdef _WIN32
-#define GINAC_HASH_USE_MANGLED_NAME 1
-#endif
-namespace GiNaC
-{
#ifndef GINAC_HASH_USE_MANGLED_NAME
static inline unsigned make_hash_seed(const std::type_info& tinfo)
{
- // this pointer is the same for all objects of the same type.
- // Hence we can use that pointer
+ // This pointer is the same for all objects of the same type.
+ // Hence we can use it.
const void* mangled_name_ptr = (const void*)tinfo.name();
unsigned v = golden_ratio_hash((p_int)mangled_name_ptr);
return v;