]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
calchash(): work around broken RTTI.
[ginac.git] / ginac / symbol.cpp
index aa8ebc0fc28a00f254c5209418a1f67883852da1..a736088903872dd854dfe55c34020a08a6aed1ea 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <string>
-#include <stdexcept>
-#include <map>
-
 #include "symbol.h"
 #include "lst.h"
 #include "archive.h"
 #include "tostring.h"
 #include "utils.h"
+#include "hash_seed.h"
 #include "inifcns.h"
 
+#include <map>
+#include <stdexcept>
+#include <string>
+
 namespace GiNaC {
 
 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(symbol, basic,
@@ -253,8 +254,8 @@ bool symbol::is_equal_same_type(const basic & other) const
 
 unsigned symbol::calchash() const
 {
-       const void* this_tinfo = (const void*)typeid(*this).name();
-       hashvalue = golden_ratio_hash((p_int)this_tinfo ^ serial);
+       unsigned seed = make_hash_seed(typeid(*this));
+       hashvalue = golden_ratio_hash(seed ^ serial);
        setflag(status_flags::hash_calculated);
        return hashvalue;
 }