diff options
author | Li Jin <dragon-fly@qq.com> | 2021-08-17 23:09:27 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-08-17 23:09:27 +0800 |
commit | 38908616d0e08b72e6b00d18490ed917fa643e4f (patch) | |
tree | 4311b80a505f4c3819c8cb2c3c937296fef0356f /src/3rdParty/lua/ltable.c | |
parent | 792e942f5269655ee03c48400999f3604b84396c (diff) | |
download | yuescript-38908616d0e08b72e6b00d18490ed917fa643e4f.tar.gz yuescript-38908616d0e08b72e6b00d18490ed917fa643e4f.tar.bz2 yuescript-38908616d0e08b72e6b00d18490ed917fa643e4f.zip |
reset Yuescript version since it's a minor version with new feature. update Lua lib.
Diffstat (limited to 'src/3rdParty/lua/ltable.c')
-rw-r--r-- | src/3rdParty/lua/ltable.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/3rdParty/lua/ltable.c b/src/3rdParty/lua/ltable.c index 33c1ab3..af87836 100644 --- a/src/3rdParty/lua/ltable.c +++ b/src/3rdParty/lua/ltable.c | |||
@@ -84,8 +84,6 @@ | |||
84 | #define hashstr(t,str) hashpow2(t, (str)->hash) | 84 | #define hashstr(t,str) hashpow2(t, (str)->hash) |
85 | #define hashboolean(t,p) hashpow2(t, p) | 85 | #define hashboolean(t,p) hashpow2(t, p) |
86 | 86 | ||
87 | #define hashint(t,i) hashpow2(t, i) | ||
88 | |||
89 | 87 | ||
90 | #define hashpointer(t,p) hashmod(t, point2uint(p)) | 88 | #define hashpointer(t,p) hashmod(t, point2uint(p)) |
91 | 89 | ||
@@ -101,6 +99,20 @@ static const Node dummynode_ = { | |||
101 | static const TValue absentkey = {ABSTKEYCONSTANT}; | 99 | static const TValue absentkey = {ABSTKEYCONSTANT}; |
102 | 100 | ||
103 | 101 | ||
102 | /* | ||
103 | ** Hash for integers. To allow a good hash, use the remainder operator | ||
104 | ** ('%'). If integer fits as a non-negative int, compute an int | ||
105 | ** remainder, which is faster. Otherwise, use an unsigned-integer | ||
106 | ** remainder, which uses all bits and ensures a non-negative result. | ||
107 | */ | ||
108 | static Node *hashint (const Table *t, lua_Integer i) { | ||
109 | lua_Unsigned ui = l_castS2U(i); | ||
110 | if (ui <= (unsigned int)INT_MAX) | ||
111 | return hashmod(t, cast_int(ui)); | ||
112 | else | ||
113 | return hashmod(t, ui); | ||
114 | } | ||
115 | |||
104 | 116 | ||
105 | /* | 117 | /* |
106 | ** Hash for floating-point numbers. | 118 | ** Hash for floating-point numbers. |