Allow table.remove to work with the hash part too
@@ -1460,12 +1460,13 @@ local function generate_exp_builtin_table_remove(exp, ctx)
${UI_DECL} = luaH_getn(${CVALUE_T});
if (TITAN_LIKELY(${UI} > 0)) {
${UI} = ${UI} - 1;
- ${SLOT_DECL} = &${CVALUE_T}->array[${UI}];
- setempty(${SLOT});
- ${HALFSIZE_DECL} = ${CVALUE_T}->sizearray / 2;
- if (${UI} < ${HALFSIZE}) {
- luaH_resizearray(L, ${CVALUE_T}, ${HALFSIZE});
+ ${SLOT_DECL};
+ if (TITAN_LIKELY(${UI} < ${CVALUE_T}->sizearray)) {
+ ${SLOT} = &${CVALUE_T}->array[${UI}];
+ } else {
+ ${SLOT} = (TValue *) luaH_getint(${CVALUE_T}, ${UI});
}
+ setempty(${SLOT});
}
]], {
CSTATS_T = cstats_t,
