Corrected support for 16-bit systems

We still need access to a 16-bit system to correctly test
these changes.
This commit is contained in:
Roberto Ierusalimschy
2023-03-09 11:10:04 -03:00
parent 02bab9fc25
commit 1de2f31694
3 changed files with 8 additions and 10 deletions

View File

@@ -257,9 +257,11 @@ LUAI_FUNC unsigned int luaH_realasize (const Table *t) {
size |= (size >> 2);
size |= (size >> 4);
size |= (size >> 8);
#if (UINT_MAX >> 14) > 3 /* unsigned int has more than 16 bits */
size |= (size >> 16);
#if (UINT_MAX >> 30) > 3
size |= (size >> 32); /* unsigned int has more than 32 bits */
#endif
#endif
size++;
lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size);