X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Ftag.cpp;h=c5824aec4e114d60b04c53acd00ae2b54072f7fe;hp=c8041e0d0331c8c20fc7f78a657b39d651e5daab;hb=553f3ec4fbe28a37978ee53b9b6e22fedb691e1d;hpb=c6aea1bc1586ffef132e6fffdf99343cb56617db diff --git a/source/tag.cpp b/source/tag.cpp index c8041e0d..c5824aec 100644 --- a/source/tag.cpp +++ b/source/tag.cpp @@ -1,21 +1,17 @@ +#include +#include #include "tag.h" namespace Msp { namespace GL { Tag::Tag(const char *s): - id(0) -{ - for(const char *i=s; *i; ++i) - id=id*id+*i; -} + id((s && *s) ? hash32(s, strlen(s)) : 0) +{ } Tag::Tag(const std::string &s): - id(0) -{ - for(std::string::const_iterator i=s.begin(); i!=s.end(); ++i) - id=id*id+*i; -} + id(s.empty() ? 0 : hash32(s)) +{ } } // namespace GL } // namespace Msp