From 02e8724bbd180904fd9fdec47ae32e1e45fa37aa Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 26 Oct 2006 23:26:52 +0000 Subject: Tweak hash generation to make it faster git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5545 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/hashcomp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index e00494041..4b3200512 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -87,9 +87,9 @@ size_t nspace::hash::operator()(const string &s) const * This avoids a copy to use hash */ register size_t t = 0; - for (std::string::const_iterator x = s.begin(); x != s.end(); x++) /* ++x not x++, so we don't hash the \0 */ + for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */ t = 5 * t + lowermap[(unsigned char)*x]; - return size_t(t); + return t; } bool irc::StrHashComp::operator()(const std::string& s1, const std::string& s2) const -- cgit v1.2.3