Skip to content
Snippets Groups Projects
Commit 046b6529 authored by neil's avatar neil
Browse files

Handle different pointer sizes, particular on Mac

git-svn-id: http://svn.net-core.org/repos/t-engine4@2947 51575b47-30f0-44d4-a5cc-537603b46e54
parent 552d82aa
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,16 @@ void stackDump (lua_State *L) {
case LUA_TNUMBER:
printf("%d: %g\n", i, lua_tonumber(L, i));
break;
default: printf("%d: %s // %x\n", i, lua_typename(L, t), lua_topointer(L, i)); break;
default:
#if defined(__PTRDIFF_TYPE__)
if((sizeof(__PTRDIFF_TYPE__) == sizeof(long int)))
printf("%d: %s // %lx\n", i, lua_typename(L, t), (unsigned long int)lua_topointer(L, i));
else
printf("%d: %s // %x\n", i, lua_typename(L, t), (unsigned int)lua_topointer(L, i));
#else
printf("%d: %s // %x\n", i, lua_typename(L, t), lua_topointer(L, i));
#endif
break;
}
i--;
}
......
......@@ -624,7 +624,16 @@ static int map_set_grid(lua_State *L)
// We use the pointer value directly as an index
if (map->grids[x][y][i])
{
#if defined(__PTRDIFF_TYPE__)
if(sizeof(__PTRDIFF_TYPE__) == sizeof(long int))
lua_pushnumber(L, (unsigned long int)map->grids[x][y][i]);
else if(sizeof(__PTRDIFF_TYPE__) == sizeof(long long))
lua_pushnumber(L, (long long)map->grids[x][y][i]);
else
lua_pushnumber(L, (int)map->grids[x][y][i]);
#else
lua_pushnumber(L, (long long)map->grids[x][y][i]);
#endif
lua_pushnil(L);
lua_settable(L, 5); // Access the list of all mos for the map
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment