aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-13 16:17:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-05-13 16:17:21 -0300
commit279c3a6961c60252f0368fdea889caf977f85fe0 (patch)
tree1614c0b508f34657f81d155dec6dffd92e671479 /ltable.c
parent49c42f3615bd876657bf697e3bf040ce796ae238 (diff)
downloadlua-279c3a6961c60252f0368fdea889caf977f85fe0.tar.gz
lua-279c3a6961c60252f0368fdea889caf977f85fe0.tar.bz2
lua-279c3a6961c60252f0368fdea889caf977f85fe0.zip
A few changes in tests about number of bits in integers
- The preprocessor must work with at least 'long', and therefore must do shifts of up to 31 bits correctly. - Whenever possible, use unsigned types in shifts.
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ltable.c b/ltable.c
index 628c640c..d8ff3d80 100644
--- a/ltable.c
+++ b/ltable.c
@@ -214,8 +214,8 @@ LUAI_FUNC unsigned int luaH_realasize (const Table *t) {
214 size |= (size >> 4); 214 size |= (size >> 4);
215 size |= (size >> 8); 215 size |= (size >> 8);
216 size |= (size >> 16); 216 size |= (size >> 16);
217#if (INT_MAX >> 30 >> 1) > 0 217#if (UINT_MAX >> 30) > 3
218 size |= (size >> 32); /* int has more than 32 bits */ 218 size |= (size >> 32); /* unsigned int has more than 32 bits */
219#endif 219#endif
220 size++; 220 size++;
221 lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size); 221 lua_assert(ispow2(size) && size/2 < t->alimit && t->alimit < size);