Added some casts for 32-bit machines
When both 'int' and 'l_obj' have 32 bits, an unsigned int needs a cast to be assigned to 'l_obj'. (As long as 'l_obj' can count the total memory used by the system, these casts should be safe.)
This commit is contained in:
2
lgc.c
2
lgc.c
@@ -624,7 +624,7 @@ static l_mem traversetable (global_State *g, Table *h) {
|
|||||||
linkgclist(h, g->allweak); /* must clear collected entries */
|
linkgclist(h, g->allweak); /* must clear collected entries */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 1 + 2*sizenode(h) + h->asize;
|
return cast(l_mem, 1 + 2*sizenode(h) + h->asize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
/*
|
/*
|
||||||
** 'l_mem' is a signed integer big enough to count the total memory
|
** 'l_mem' is a signed integer big enough to count the total memory
|
||||||
** used by Lua. (It is signed due to the use of debt in several
|
** used by Lua. (It is signed due to the use of debt in several
|
||||||
** computations.) Usually, 'ptrdiff_t' should work, but we use 'long'
|
** computations.) 'lu_mem' is a corresponding unsigned type. Usually,
|
||||||
** for 16-bit machines.
|
** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines.
|
||||||
*/
|
*/
|
||||||
#if defined(LUAI_MEM) /* { external definitions? */
|
#if defined(LUAI_MEM) /* { external definitions? */
|
||||||
typedef LUAI_MEM l_mem;
|
typedef LUAI_MEM l_mem;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ lu_byte luaO_codeparam (unsigned int p) {
|
|||||||
** overflow, so we check which order is best.
|
** overflow, so we check which order is best.
|
||||||
*/
|
*/
|
||||||
l_mem luaO_applyparam (lu_byte p, l_mem x) {
|
l_mem luaO_applyparam (lu_byte p, l_mem x) {
|
||||||
unsigned int m = p & 0xF; /* mantissa */
|
int m = p & 0xF; /* mantissa */
|
||||||
int e = (p >> 4); /* exponent */
|
int e = (p >> 4); /* exponent */
|
||||||
if (e > 0) { /* normalized? */
|
if (e > 0) { /* normalized? */
|
||||||
e--; /* correct exponent */
|
e--; /* correct exponent */
|
||||||
|
|||||||
Reference in New Issue
Block a user