]> git.tdb.fi Git - libs/gl.git/blob - source/tag.cpp
Drop Id tags and copyright notices from files
[libs/gl.git] / source / tag.cpp
1 #include "tag.h"
2
3 namespace {
4
5 template<typename T>
6 inline unsigned hash(T begin, T end)
7 {
8         unsigned result = 0;
9         for(T i=begin; (i!=end && *i); ++i)
10                 result = ((result>>29)|(result<<5))^static_cast<unsigned char>(*i);
11         return result;
12 }
13
14 }
15
16 namespace Msp {
17 namespace GL {
18
19 Tag::Tag(const char *s):
20         id(s ? hash<const char *>(s, 0) : 0)
21 { }
22
23 Tag::Tag(const std::string &s):
24         id(hash(s.begin(), s.end()))
25 { }
26
27 } // namespace GL
28 } // namespace Msp