Changeset 2105
- Timestamp:
- Nov 21, 2012, 11:50:55 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Makefile.am
r2100 r2105 18 18 \ 19 19 lol/unit.h lol/debug.h \ 20 lol/core/ array.h lol/core/string.h lol/core/hash.h \20 lol/core/types.h lol/core/array.h lol/core/string.h lol/core/hash.h \ 21 21 lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \ 22 22 lol/math/math.h \ … … 39 39 $(d3d9_sources) \ 40 40 $(android_sources) \ 41 $(bullet_sources) \42 41 \ 43 42 core/hash.cpp core/string.cpp \ … … 76 75 loldebug.h \ 77 76 debug/fps.cpp debug/fps.h \ 78 debug/record.cpp debug/record.h debug/stats.cpp debug/stats.h 77 debug/record.cpp debug/record.h debug/stats.cpp debug/stats.h \ 78 \ 79 $(bullet_sources) 79 80 liblol_a_CPPFLAGS = @LOL_CFLAGS@ -I$(srcdir)/bullet 80 81 -
trunk/src/core.h
r2097 r2105 76 76 // Base types 77 77 #include <lol/debug.h> 78 #include <lol/core/types.h> 78 79 #include <lol/core/array.h> 79 80 #include <lol/core/string.h> -
trunk/src/core/hash.cpp
r2104 r2105 42 42 43 43 /* 44 * Public Hash classes44 * Helper hash functions 45 45 */ 46 46 47 uint32_t Hash<int8_t>::operator ()(int8_t x)47 static inline uint32_t Hash8(uint8_t x) 48 48 { 49 49 uint32_t ret = 0xffffffffu; … … 52 52 } 53 53 54 uint32_t Hash<uint8_t>::operator ()(uint8_t x) 55 { 56 uint32_t ret = 0xffffffffu; 57 ret = data.crc32_table[(uint8_t)(ret ^ x)] ^ (ret >> 8); 58 return ret ^ 0xffffffffu; 59 } 60 61 uint32_t Hash<int16_t>::operator ()(int16_t x) 54 static inline uint32_t Hash16(uint16_t x) 62 55 { 63 56 uint32_t ret = 0xffffffffu; … … 67 60 } 68 61 69 uint32_t Hash<uint16_t>::operator ()(uint16_t x) 70 { 71 uint32_t ret = 0xffffffffu; 72 ret = data.crc32_table[(uint8_t)(ret ^ x)] ^ (ret >> 8); 73 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 8))] ^ (ret >> 8); 74 return ret ^ 0xffffffffu; 75 } 76 77 uint32_t Hash<int32_t>::operator ()(int32_t x) 62 static inline uint32_t Hash32(uint32_t x) 78 63 { 79 64 uint32_t ret = 0xffffffffu; … … 85 70 } 86 71 87 uint32_t Hash<uint32_t>::operator ()(uint32_t x) 88 { 89 uint32_t ret = 0xffffffffu; 90 ret = data.crc32_table[(uint8_t)(ret ^ x)] ^ (ret >> 8); 91 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 8))] ^ (ret >> 8); 92 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 16))] ^ (ret >> 8); 93 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 24))] ^ (ret >> 8); 94 return ret ^ 0xffffffffu; 95 } 96 97 uint32_t Hash<int64_t>::operator ()(int64_t x) 72 static inline uint32_t Hash64(uint64_t x) 98 73 { 99 74 uint32_t ret = 0xffffffffu; … … 109 84 } 110 85 86 /* 87 * Integer hash functions 88 */ 89 90 uint32_t Hash<int8_t>::operator ()(int8_t x) 91 { 92 return Hash8((uint8_t)x); 93 } 94 95 uint32_t Hash<uint8_t>::operator ()(uint8_t x) 96 { 97 return Hash8(x); 98 } 99 100 uint32_t Hash<int16_t>::operator ()(int16_t x) 101 { 102 return Hash16((uint16_t)x); 103 } 104 105 uint32_t Hash<uint16_t>::operator ()(uint16_t x) 106 { 107 return Hash16(x); 108 } 109 110 uint32_t Hash<int32_t>::operator ()(int32_t x) 111 { 112 return Hash32((uint32_t)x); 113 } 114 115 uint32_t Hash<uint32_t>::operator ()(uint32_t x) 116 { 117 return Hash32(x); 118 } 119 120 uint32_t Hash<int64_t>::operator ()(int64_t x) 121 { 122 return Hash64((uint64_t)x); 123 } 124 111 125 uint32_t Hash<uint64_t>::operator ()(uint64_t x) 112 126 { 113 uint32_t ret = 0xffffffffu; 114 ret = data.crc32_table[(uint8_t)(ret ^ x)] ^ (ret >> 8); 115 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 8))] ^ (ret >> 8); 116 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 16))] ^ (ret >> 8); 117 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 24))] ^ (ret >> 8); 118 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 32))] ^ (ret >> 8); 119 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 40))] ^ (ret >> 8); 120 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 48))] ^ (ret >> 8); 121 ret = data.crc32_table[(uint8_t)(ret ^ (x >> 56))] ^ (ret >> 8); 122 return ret ^ 0xffffffffu; 127 return Hash64(x); 123 128 } 129 130 /* 131 * Floating-point hash functions 132 */ 133 134 uint32_t Hash<half>::operator ()(half f) 135 { 136 return Hash16(f.bits); 137 } 138 139 uint32_t Hash<float>::operator ()(float f) 140 { 141 union { float tmp; uint32_t x; } u = { f }; 142 return Hash32(u.x); 143 } 144 145 uint32_t Hash<double>::operator ()(double f) 146 { 147 union { double tmp; uint64_t x; } u = { f }; 148 return Hash64(u.x); 149 } 150 151 /* 152 * String and array hash functions 153 */ 124 154 125 155 static uint32_t HashCharString(char const *s) -
trunk/src/lol/core/array.h
r2086 r2105 16 16 // 17 17 18 #if !defined __LOL_ ARRAY_H__19 #define __LOL_ ARRAY_H__18 #if !defined __LOL_CORE_ARRAY_H__ 19 #define __LOL_CORE_ARRAY_H__ 20 20 21 21 #include <new> … … 508 508 } /* namespace lol */ 509 509 510 #endif // __LOL_ ARRAY_H__511 510 #endif // __LOL_CORE_ARRAY_H__ 511 -
trunk/src/lol/core/hash.h
r2104 r2105 15 15 // 16 16 17 #if !defined __LOL_ HASH_H__18 #define __LOL_ HASH_H__17 #if !defined __LOL_CORE_HASH_H__ 18 #define __LOL_CORE_HASH_H__ 19 19 20 20 namespace lol … … 32 32 template<> class Hash<uint64_t> { public: uint32_t operator()(uint64_t); }; 33 33 34 template<> class Hash<half> { public: uint32_t operator()(half); }; 35 template<> class Hash<float> { public: uint32_t operator()(float); }; 36 template<> class Hash<double> { public: uint32_t operator()(double); }; 37 template<> class Hash<ldouble> { public: uint32_t operator()(ldouble); }; 38 34 39 template<> class Hash<char const *> 35 40 { … … 46 51 } /* namespace lol */ 47 52 48 #endif // __LOL_ HASH_H__53 #endif // __LOL_CORE_HASH_H__ 49 54 -
trunk/src/lol/core/string.h
r2100 r2105 15 15 // 16 16 17 #if !defined __LOL_ STRING_H__18 #define __LOL_ STRING_H__17 #if !defined __LOL_CORE_STRING_H__ 18 #define __LOL_CORE_STRING_H__ 19 19 20 20 #include <lol/core/array.h> … … 120 120 } /* namespace lol */ 121 121 122 #endif // __LOL_ STRING_H__122 #endif // __LOL_CORE_STRING_H__ 123 123 -
trunk/src/lol/math/math.h
r2058 r2105 29 29 #undef min 30 30 #undef max 31 32 /* There are many reasons for wanting single-word type names, the most33 * important one being compilation speedups in our vector.h: we can hide34 * some global methods in namespaces that contain the name of the type,35 * but namespaces cannot have spaces in their names. */36 typedef long double ldouble;37 31 38 32 /* Standard cmath functions */ -
trunk/src/lol/math/real.h
r1893 r2105 200 200 201 201 /* 202 * The real type used for real numbers203 */204 typedef Real<16> real;205 206 /*207 202 * Mandatory forward declarations of template specialisations 208 203 */ -
trunk/src/lolcore.vcxproj
r2100 r2105 586 586 <ClInclude Include="lol\core\hash.h" /> 587 587 <ClInclude Include="lol\core\string.h" /> 588 <ClInclude Include="lol\core\types.h" /> 588 589 <ClInclude Include="lol\debug.h" /> 589 590 <ClInclude Include="lol\math\half.h" /> -
trunk/src/lolcore.vcxproj.filters
r2100 r2105 734 734 </ClInclude> 735 735 <ClInclude Include="array.h"> 736 <Filter>src\...</Filter> 736 <Filter>src\core</Filter> 737 </ClInclude> 738 <ClInclude Include="types.h"> 739 <Filter>src\core</Filter> 737 740 </ClInclude> 738 741 <ClInclude Include="hash.h"> 739 <Filter>src\ ...</Filter>742 <Filter>src\core</Filter> 740 743 </ClInclude> 741 744 <ClInclude Include="audio.h">
Note: See TracChangeset
for help on using the changeset viewer.