X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fwildcard.cpp;h=d45ffca038ab5ff98505464b4f5c70318f7d615f;hp=4a89957bcaaf4cb90b30f6e9acf19b7f42971a92;hb=c018acc8ddca143ba6a202ad095b192205708bc4;hpb=b573b0146341709649f373e0fc5c0d440877ebaf diff --git a/ginac/wildcard.cpp b/ginac/wildcard.cpp index 4a89957b..d45ffca0 100644 --- a/ginac/wildcard.cpp +++ b/ginac/wildcard.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's wildcard objects. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2016 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 @@ -20,11 +20,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - #include "wildcard.h" #include "archive.h" #include "utils.h" +#include "hash_seed.h" + +#include namespace GiNaC { @@ -37,7 +38,7 @@ GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(wildcard, basic, // default constructor ////////// -wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0) +wildcard::wildcard() : label(0) { setflag(status_flags::evaluated | status_flags::expanded); } @@ -46,7 +47,7 @@ wildcard::wildcard() : inherited(&wildcard::tinfo_static), label(0) // other constructors ////////// -wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l) +wildcard::wildcard(unsigned l) : label(l) { setflag(status_flags::evaluated | status_flags::expanded); } @@ -55,11 +56,13 @@ wildcard::wildcard(unsigned l) : inherited(&wildcard::tinfo_static), label(l) // archiving ////////// -wildcard::wildcard(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst) +void wildcard::read_archive(const archive_node& n, lst& sym_lst) { + inherited::read_archive(n, sym_lst); n.find_unsigned("label", label); setflag(status_flags::evaluated | status_flags::expanded); } +GINAC_BIND_UNARCHIVER(wildcard); void wildcard::archive(archive_node &n) const { @@ -67,8 +70,6 @@ void wildcard::archive(archive_node &n) const n.add_unsigned("label", label); } -DEFAULT_UNARCHIVE(wildcard) - ////////// // functions overriding virtual functions from base classes ////////// @@ -106,8 +107,8 @@ unsigned wildcard::calchash() const // this is where the schoolbook method // (golden_ratio_hash(typeid(*this).name()) ^ label) // is not good enough yet... - const void* this_tinfo = (const void*)typeid(*this).name(); - hashvalue = golden_ratio_hash(golden_ratio_hash((p_int)this_tinfo) ^ label); + unsigned seed = make_hash_seed(typeid(*this)); + hashvalue = golden_ratio_hash(seed ^ label); setflag(status_flags::hash_calculated); return hashvalue; }