source: trunk/src/lol/core/hash.h @ 2105

Last change on this file since 2105 was 2105, checked in by sam, 8 years ago

core: implement hashing functions for half, float and double.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Hash class
13// --------------
14// A very simple Hash class.
15//
16
17#if !defined __LOL_CORE_HASH_H__
18#define __LOL_CORE_HASH_H__
19
20namespace lol
21{
22
23template<typename T> class Hash;
24
25template<> class Hash<int8_t>   { public: uint32_t operator()(int8_t); };
26template<> class Hash<uint8_t>  { public: uint32_t operator()(uint8_t); };
27template<> class Hash<int16_t>  { public: uint32_t operator()(int16_t); };
28template<> class Hash<uint16_t> { public: uint32_t operator()(uint16_t); };
29template<> class Hash<int32_t>  { public: uint32_t operator()(int32_t); };
30template<> class Hash<uint32_t> { public: uint32_t operator()(uint32_t); };
31template<> class Hash<int64_t>  { public: uint32_t operator()(int64_t); };
32template<> class Hash<uint64_t> { public: uint32_t operator()(uint64_t); };
33
34template<> class Hash<half>     { public: uint32_t operator()(half); };
35template<> class Hash<float>    { public: uint32_t operator()(float); };
36template<> class Hash<double>   { public: uint32_t operator()(double); };
37template<> class Hash<ldouble>  { public: uint32_t operator()(ldouble); };
38
39template<> class Hash<char const *>
40{
41public:
42    uint32_t operator()(char const *x);
43};
44
45template<> class Hash<String>
46{
47public:
48    uint32_t operator()(String const &s);
49};
50
51} /* namespace lol */
52
53#endif // __LOL_CORE_HASH_H__
54
Note: See TracBrowser for help on using the repository browser.