Hi,
I tried to compile LUA for 16-bit DOS by Open Watcom compiler.
It compile without fatal errors but Warnings reported by compiler signal bug for any 16-bit target.
The problem is that size of int type is only 2-byte (16-bit) but in source code it is not taken into acount. I atached patch for two such situations. First is with ccall function declaration in ldo.c file and second in realasize function in ltable.c file. Second problem is with right shift for 16-bit value and shift value is greater then 16.
diff --git a/ldo.c b/ldo.c
index c30cde76..a2a68fa5 100644
--- a/ldo.c
+++ b/ldo.c
@@ -629,7 +629,7 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) {
** check the stack before doing anything else. 'luaD_precall' already
** does that.
*/
-l_sinline void ccall (lua_State *L, StkId func, int nResults, int inc) {
+l_sinline void ccall (lua_State *L, StkId func, int nResults, l_uint32 inc) {
CallInfo *ci;
L->nCcalls += inc;
if (l_unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) {
diff --git a/ltable.c b/ltable.c
index cc7993e0..a7e5ea5e 100644
--- a/ltable.c
+++ b/ltable.c
@@ -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
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);
Regards
Jiri