'objsize' returns 'l_mem'

Sums of size_t may not fit in a size_t.
This commit is contained in:
Roberto Ierusalimschy
2024-11-15 12:04:53 -03:00
parent d4247befa1
commit a4762b6ffe
7 changed files with 40 additions and 25 deletions

View File

@@ -863,8 +863,9 @@ Table *luaH_new (lua_State *L) {
}
size_t luaH_size (Table *t) {
size_t sz = sizeof(Table) + luaH_realasize(t) * (sizeof(Value) + 1);
lu_mem luaH_size (Table *t) {
lu_mem sz = cast(lu_mem, sizeof(Table))
+ luaH_realasize(t) * (sizeof(Value) + 1);
if (!isdummy(t))
sz += sizehash(t);
return sz;