]> git.tdb.fi Git - libs/gl.git/blobdiff - source/tag.cpp
Add a utility class for switching renderables
[libs/gl.git] / source / tag.cpp
index 8e29bee1f3eba6f97665bc9abd0e3fb60dd24d99..c5824aec4e114d60b04c53acd00ae2b54072f7fe 100644 (file)
@@ -1,28 +1,17 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <cstring>
+#include <msp/core/hash.h>
 #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