Some 'unsigned int' changed to 'unsigned'
'unsigned int' is too long sometimes. (We already write 'long' instead of 'long int'...)
This commit is contained in:
2
lcode.h
2
lcode.h
@@ -60,7 +60,7 @@ typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
|
|||||||
#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
|
#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
|
||||||
|
|
||||||
LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
|
LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
|
||||||
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
|
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned Bx);
|
||||||
LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
|
LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
|
||||||
int B, int C, int k);
|
int B, int C, int k);
|
||||||
LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);
|
LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ typedef signed char ls_byte;
|
|||||||
#define L_P2I size_t
|
#define L_P2I size_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX))
|
#define point2uint(p) cast_uint((L_P2I)(p) & UINT_MAX)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
lstate.c
2
lstate.c
@@ -320,7 +320,7 @@ LUA_API int lua_closethread (lua_State *L, lua_State *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned int seed) {
|
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned seed) {
|
||||||
int i;
|
int i;
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
global_State *g;
|
global_State *g;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ int luaS_eqlngstr (TString *a, TString *b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
|
unsigned luaS_hash (const char *str, size_t l, unsigned seed) {
|
||||||
unsigned int h = seed ^ cast_uint(l);
|
unsigned int h = seed ^ cast_uint(l);
|
||||||
for (; l > 0; l--)
|
for (; l > 0; l--)
|
||||||
h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1]));
|
h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1]));
|
||||||
@@ -48,7 +48,7 @@ unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int luaS_hashlongstr (TString *ts) {
|
unsigned luaS_hashlongstr (TString *ts) {
|
||||||
lua_assert(ts->tt == LUA_VLNGSTR);
|
lua_assert(ts->tt == LUA_VLNGSTR);
|
||||||
if (ts->extra == 0) { /* no hash? */
|
if (ts->extra == 0) { /* no hash? */
|
||||||
size_t len = ts->u.lnglen;
|
size_t len = ts->u.lnglen;
|
||||||
@@ -155,7 +155,7 @@ size_t luaS_sizelngstr (size_t len, int kind) {
|
|||||||
** creates a new string object
|
** creates a new string object
|
||||||
*/
|
*/
|
||||||
static TString *createstrobj (lua_State *L, size_t totalsize, int tag,
|
static TString *createstrobj (lua_State *L, size_t totalsize, int tag,
|
||||||
unsigned int h) {
|
unsigned h) {
|
||||||
TString *ts;
|
TString *ts;
|
||||||
GCObject *o;
|
GCObject *o;
|
||||||
o = luaC_newobj(L, tag, totalsize);
|
o = luaC_newobj(L, tag, totalsize);
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
|
#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
|
||||||
|
|
||||||
|
|
||||||
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
|
LUAI_FUNC unsigned luaS_hash (const char *str, size_t l, unsigned seed);
|
||||||
LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
|
LUAI_FUNC unsigned luaS_hashlongstr (TString *ts);
|
||||||
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
|
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
|
||||||
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
|
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
|
||||||
LUAI_FUNC void luaS_clearcache (global_State *g);
|
LUAI_FUNC void luaS_clearcache (global_State *g);
|
||||||
|
|||||||
20
ltable.c
20
ltable.c
@@ -358,8 +358,8 @@ static unsigned int arrayindex (lua_Integer k) {
|
|||||||
** elements in the array part, then elements in the hash part. The
|
** elements in the array part, then elements in the hash part. The
|
||||||
** beginning of a traversal is signaled by 0.
|
** beginning of a traversal is signaled by 0.
|
||||||
*/
|
*/
|
||||||
static unsigned int findindex (lua_State *L, Table *t, TValue *key,
|
static unsigned findindex (lua_State *L, Table *t, TValue *key,
|
||||||
unsigned int asize) {
|
unsigned asize) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
if (ttisnil(key)) return 0; /* first iteration */
|
if (ttisnil(key)) return 0; /* first iteration */
|
||||||
i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0;
|
i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0;
|
||||||
@@ -462,7 +462,7 @@ static int keyinarray (Table *t, lua_Integer key) {
|
|||||||
** will go to the array part; return the optimal size. (The condition
|
** will go to the array part; return the optimal size. (The condition
|
||||||
** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.)
|
** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.)
|
||||||
*/
|
*/
|
||||||
static unsigned int computesizes (unsigned int nums[], unsigned int *pna) {
|
static unsigned computesizes (unsigned nums[], unsigned *pna) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int twotoi; /* 2^i (candidate for optimal size) */
|
unsigned int twotoi; /* 2^i (candidate for optimal size) */
|
||||||
unsigned int a = 0; /* number of elements smaller than 2^i */
|
unsigned int a = 0; /* number of elements smaller than 2^i */
|
||||||
@@ -506,7 +506,7 @@ l_sinline int arraykeyisempty (const Table *t, lua_Integer key) {
|
|||||||
** number of keys that will go into corresponding slice and return
|
** number of keys that will go into corresponding slice and return
|
||||||
** total number of non-nil keys.
|
** total number of non-nil keys.
|
||||||
*/
|
*/
|
||||||
static unsigned int numusearray (const Table *t, unsigned int *nums) {
|
static unsigned numusearray (const Table *t, unsigned *nums) {
|
||||||
int lg;
|
int lg;
|
||||||
unsigned int ttlg; /* 2^lg */
|
unsigned int ttlg; /* 2^lg */
|
||||||
unsigned int ause = 0; /* summation of 'nums' */
|
unsigned int ause = 0; /* summation of 'nums' */
|
||||||
@@ -533,7 +533,7 @@ static unsigned int numusearray (const Table *t, unsigned int *nums) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) {
|
static int numusehash (const Table *t, unsigned *nums, unsigned *pna) {
|
||||||
int totaluse = 0; /* total number of elements */
|
int totaluse = 0; /* total number of elements */
|
||||||
int ause = 0; /* elements added to 'nums' (can go to array part) */
|
int ause = 0; /* elements added to 'nums' (can go to array part) */
|
||||||
int i = sizenode(t);
|
int i = sizenode(t);
|
||||||
@@ -567,8 +567,8 @@ static size_t concretesize (unsigned int size) {
|
|||||||
|
|
||||||
|
|
||||||
static ArrayCell *resizearray (lua_State *L , Table *t,
|
static ArrayCell *resizearray (lua_State *L , Table *t,
|
||||||
unsigned int oldasize,
|
unsigned oldasize,
|
||||||
unsigned int newasize) {
|
unsigned newasize) {
|
||||||
size_t oldasizeb = concretesize(oldasize);
|
size_t oldasizeb = concretesize(oldasize);
|
||||||
size_t newasizeb = concretesize(newasize);
|
size_t newasizeb = concretesize(newasize);
|
||||||
void *a = luaM_reallocvector(L, t->array, oldasizeb, newasizeb, lu_byte);
|
void *a = luaM_reallocvector(L, t->array, oldasizeb, newasizeb, lu_byte);
|
||||||
@@ -583,7 +583,7 @@ static ArrayCell *resizearray (lua_State *L , Table *t,
|
|||||||
** comparison ensures that the shift in the second one does not
|
** comparison ensures that the shift in the second one does not
|
||||||
** overflow.
|
** overflow.
|
||||||
*/
|
*/
|
||||||
static void setnodevector (lua_State *L, Table *t, unsigned int size) {
|
static void setnodevector (lua_State *L, Table *t, unsigned size) {
|
||||||
if (size == 0) { /* no elements to hash part? */
|
if (size == 0) { /* no elements to hash part? */
|
||||||
t->node = cast(Node *, dummynode); /* use common 'dummynode' */
|
t->node = cast(Node *, dummynode); /* use common 'dummynode' */
|
||||||
t->lsizenode = 0;
|
t->lsizenode = 0;
|
||||||
@@ -695,8 +695,8 @@ static void clearNewSlice (Table *t, unsigned oldasize, unsigned newasize) {
|
|||||||
** nils and reinserts the elements of the old hash back into the new
|
** nils and reinserts the elements of the old hash back into the new
|
||||||
** parts of the table.
|
** parts of the table.
|
||||||
*/
|
*/
|
||||||
void luaH_resize (lua_State *L, Table *t, unsigned int newasize,
|
void luaH_resize (lua_State *L, Table *t, unsigned newasize,
|
||||||
unsigned int nhsize) {
|
unsigned nhsize) {
|
||||||
Table newt; /* to keep the new hash part */
|
Table newt; /* to keep the new hash part */
|
||||||
unsigned int oldasize = setlimittosize(t);
|
unsigned int oldasize = setlimittosize(t);
|
||||||
ArrayCell *newarray;
|
ArrayCell *newarray;
|
||||||
|
|||||||
8
ltable.h
8
ltable.h
@@ -151,13 +151,13 @@ LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key,
|
|||||||
LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
|
LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
|
||||||
TValue *value, int hres);
|
TValue *value, int hres);
|
||||||
LUAI_FUNC Table *luaH_new (lua_State *L);
|
LUAI_FUNC Table *luaH_new (lua_State *L);
|
||||||
LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
|
LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned nasize,
|
||||||
unsigned int nhsize);
|
unsigned nhsize);
|
||||||
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
|
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned nasize);
|
||||||
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
|
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
|
||||||
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
|
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
|
||||||
LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
|
LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
|
||||||
LUAI_FUNC unsigned int luaH_realasize (const Table *t);
|
LUAI_FUNC unsigned luaH_realasize (const Table *t);
|
||||||
|
|
||||||
|
|
||||||
#if defined(LUA_DEBUG)
|
#if defined(LUA_DEBUG)
|
||||||
|
|||||||
@@ -329,8 +329,7 @@ static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
|
|||||||
/*
|
/*
|
||||||
** Quicksort algorithm (recursive function)
|
** Quicksort algorithm (recursive function)
|
||||||
*/
|
*/
|
||||||
static void auxsort (lua_State *L, IdxT lo, IdxT up,
|
static void auxsort (lua_State *L, IdxT lo, IdxT up, unsigned rnd) {
|
||||||
unsigned int rnd) {
|
|
||||||
while (lo < up) { /* loop for tail recursion */
|
while (lo < up) { /* loop for tail recursion */
|
||||||
IdxT p; /* Pivot index */
|
IdxT p; /* Pivot index */
|
||||||
IdxT n; /* to be used later */
|
IdxT n; /* to be used later */
|
||||||
|
|||||||
2
ltests.c
2
ltests.c
@@ -1008,7 +1008,7 @@ static int table_query (lua_State *L) {
|
|||||||
lua_pushinteger(L, t->alimit);
|
lua_pushinteger(L, t->alimit);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
else if ((unsigned int)i < asize) {
|
else if (cast_uint(i) < asize) {
|
||||||
lua_pushinteger(L, i);
|
lua_pushinteger(L, i);
|
||||||
arr2obj(t, i + 1, s2v(L->top.p));
|
arr2obj(t, i + 1, s2v(L->top.p));
|
||||||
api_incr_top(L);
|
api_incr_top(L);
|
||||||
|
|||||||
Reference in New Issue
Block a user