]> www.ginac.de Git - ginac.git/blobdiff - ginac/symmetry.cpp
Be more careful about final top-level substitution.
[ginac.git] / ginac / symmetry.cpp
index 1de84e644dd9d95737c3a0812dd544225f9f9d7b..23f9df903b98bd1d12a4f60532e6809b69d5ac23 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symmetry definitions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2010 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
@@ -26,6 +26,7 @@
 #include "operators.h"
 #include "archive.h"
 #include "utils.h"
+#include "hash_seed.h"
 
 #include <functional>
 #include <iostream>
@@ -185,12 +186,12 @@ int symmetry::compare_same_type(const basic & other) const
 
 unsigned symmetry::calchash() const
 {
-       const void* this_tinfo = (const void*)typeid(*this).name();
-       unsigned v = golden_ratio_hash((p_int)this_tinfo);
+       unsigned v = make_hash_seed(typeid(*this));
 
        if (type == none) {
                v = rotate_left(v);
-               v ^= *(indices.begin());
+               if (!indices.empty())
+                       v ^= *(indices.begin());
        } else {
                for (exvector::const_iterator i=children.begin(); i!=children.end(); ++i)
                {