diff options
author | Li Jin <dragon-fly@qq.com> | 2021-11-02 11:17:58 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2021-11-02 11:17:58 +0800 |
commit | 827c3736f357e09168fc108e8e740c6425d37d9b (patch) | |
tree | 259f977bf7f4ebe0e397fe5e1b74e7fbb1b75e8e /src/3rdParty/lua/ltable.c | |
parent | aed806476fe50899c0f01750175531ac41267b9d (diff) | |
download | yuescript-827c3736f357e09168fc108e8e740c6425d37d9b.tar.gz yuescript-827c3736f357e09168fc108e8e740c6425d37d9b.tar.bz2 yuescript-827c3736f357e09168fc108e8e740c6425d37d9b.zip |
fix a wrong code generating issue, update builtin Lua.
Diffstat (limited to 'src/3rdParty/lua/ltable.c')
-rw-r--r-- | src/3rdParty/lua/ltable.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/3rdParty/lua/ltable.c b/src/3rdParty/lua/ltable.c index af87836..c82286d 100644 --- a/src/3rdParty/lua/ltable.c +++ b/src/3rdParty/lua/ltable.c | |||
@@ -150,22 +150,22 @@ static int l_hashfloat (lua_Number n) { | |||
150 | ** and value in 'vkl') so that we can call it on keys inserted into | 150 | ** and value in 'vkl') so that we can call it on keys inserted into |
151 | ** nodes. | 151 | ** nodes. |
152 | */ | 152 | */ |
153 | static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | 153 | static Node *mainposition (const Table *t, int ktt, const Value kvl) { |
154 | switch (withvariant(ktt)) { | 154 | switch (withvariant(ktt)) { |
155 | case LUA_VNUMINT: { | 155 | case LUA_VNUMINT: { |
156 | lua_Integer key = ivalueraw(*kvl); | 156 | lua_Integer key = ivalueraw(kvl); |
157 | return hashint(t, key); | 157 | return hashint(t, key); |
158 | } | 158 | } |
159 | case LUA_VNUMFLT: { | 159 | case LUA_VNUMFLT: { |
160 | lua_Number n = fltvalueraw(*kvl); | 160 | lua_Number n = fltvalueraw(kvl); |
161 | return hashmod(t, l_hashfloat(n)); | 161 | return hashmod(t, l_hashfloat(n)); |
162 | } | 162 | } |
163 | case LUA_VSHRSTR: { | 163 | case LUA_VSHRSTR: { |
164 | TString *ts = tsvalueraw(*kvl); | 164 | TString *ts = tsvalueraw(kvl); |
165 | return hashstr(t, ts); | 165 | return hashstr(t, ts); |
166 | } | 166 | } |
167 | case LUA_VLNGSTR: { | 167 | case LUA_VLNGSTR: { |
168 | TString *ts = tsvalueraw(*kvl); | 168 | TString *ts = tsvalueraw(kvl); |
169 | return hashpow2(t, luaS_hashlongstr(ts)); | 169 | return hashpow2(t, luaS_hashlongstr(ts)); |
170 | } | 170 | } |
171 | case LUA_VFALSE: | 171 | case LUA_VFALSE: |
@@ -173,15 +173,15 @@ static Node *mainposition (const Table *t, int ktt, const Value *kvl) { | |||
173 | case LUA_VTRUE: | 173 | case LUA_VTRUE: |
174 | return hashboolean(t, 1); | 174 | return hashboolean(t, 1); |
175 | case LUA_VLIGHTUSERDATA: { | 175 | case LUA_VLIGHTUSERDATA: { |
176 | void *p = pvalueraw(*kvl); | 176 | void *p = pvalueraw(kvl); |
177 | return hashpointer(t, p); | 177 | return hashpointer(t, p); |
178 | } | 178 | } |
179 | case LUA_VLCF: { | 179 | case LUA_VLCF: { |
180 | lua_CFunction f = fvalueraw(*kvl); | 180 | lua_CFunction f = fvalueraw(kvl); |
181 | return hashpointer(t, f); | 181 | return hashpointer(t, f); |
182 | } | 182 | } |
183 | default: { | 183 | default: { |
184 | GCObject *o = gcvalueraw(*kvl); | 184 | GCObject *o = gcvalueraw(kvl); |
185 | return hashpointer(t, o); | 185 | return hashpointer(t, o); |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -691,7 +691,7 @@ void luaH_newkey (lua_State *L, Table *t, const TValue *key, TValue *value) { | |||
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | lua_assert(!isdummy(t)); | 693 | lua_assert(!isdummy(t)); |
694 | othern = mainposition(t, keytt(mp), &keyval(mp)); | 694 | othern = mainposition(t, keytt(mp), keyval(mp)); |
695 | if (othern != mp) { /* is colliding node out of its main position? */ | 695 | if (othern != mp) { /* is colliding node out of its main position? */ |
696 | /* yes; move colliding node into free position */ | 696 | /* yes; move colliding node into free position */ |
697 | while (othern + gnext(othern) != mp) /* find previous */ | 697 | while (othern + gnext(othern) != mp) /* find previous */ |