aboutsummaryrefslogtreecommitdiff
path: root/MoonParser/parser.hpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2019-09-12 16:42:44 +0800
committerLi Jin <dragon-fly@qq.com>2019-09-12 16:42:44 +0800
commit181c6e40ff8c7579d8c7fdf6c72db13ffc951c81 (patch)
treeb35aac87016bdb0a8f0367ee68b7971692ff3d38 /MoonParser/parser.hpp
parent50353c1456324e7bd3c130fceaf400aed7880a41 (diff)
downloadyuescript-181c6e40ff8c7579d8c7fdf6c72db13ffc951c81.tar.gz
yuescript-181c6e40ff8c7579d8c7fdf6c72db13ffc951c81.tar.bz2
yuescript-181c6e40ff8c7579d8c7fdf6c72db13ffc951c81.zip
cleanup.
Diffstat (limited to 'MoonParser/parser.hpp')
-rw-r--r--MoonParser/parser.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/MoonParser/parser.hpp b/MoonParser/parser.hpp
index ae83215..a84b9a3 100644
--- a/MoonParser/parser.hpp
+++ b/MoonParser/parser.hpp
@@ -17,15 +17,15 @@
17#include <locale> 17#include <locale>
18 18
19// const str hash helper functions 19// const str hash helper functions
20inline constexpr std::size_t hash(char const* input) 20inline constexpr size_t hash(char const* input)
21{ 21{
22 return *input ? *input + 33ull * hash(input + 1) : 5381; 22 return *input ? *input + 33ull * hash(input + 1) : 5381;
23} 23}
24inline std::size_t hash(const char* input, int size, int index) 24inline size_t hash(const char* input, int size, int index)
25{ 25{
26 return index < size ? input[index] + 33ull * hash(input, size, index + 1) : 5381; 26 return index < size ? input[index] + 33ull * hash(input, size, index + 1) : 5381;
27} 27}
28inline std::size_t constexpr operator"" _id(const char* s, size_t) 28inline size_t constexpr operator"" _id(const char* s, size_t)
29{ 29{
30 return hash(s); 30 return hash(s);
31} 31}