aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-03-22 14:06:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-03-22 14:06:11 -0300
commit9fa63a62682c1353eeabd4575152941fa6f3e70f (patch)
tree1aad2dd0de78388f6be134399ae4183692ce377f
parent0593256707ceddb1bc9cd4b25b822a7fbcfedd66 (diff)
downloadlua-9fa63a62682c1353eeabd4575152941fa6f3e70f.tar.gz
lua-9fa63a62682c1353eeabd4575152941fa6f3e70f.tar.bz2
lua-9fa63a62682c1353eeabd4575152941fa6f3e70f.zip
Some 'unsigned int' changed to 'unsigned'
'unsigned int' is too long sometimes. (We already write 'long' instead of 'long int'...)
Diffstat (limited to '')
-rw-r--r--lcode.h2
-rw-r--r--llimits.h2
-rw-r--r--lstate.c2
-rw-r--r--lstring.c6
-rw-r--r--lstring.h4
-rw-r--r--ltable.c20
-rw-r--r--ltable.h8
-rw-r--r--ltablib.c3
-rw-r--r--ltests.c2
9 files changed, 24 insertions, 25 deletions
diff --git a/lcode.h b/lcode.h
index 0b971fc4..5b8eb29e 100644
--- a/lcode.h
+++ b/lcode.h
@@ -60,7 +60,7 @@ typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
60#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) 60#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
61 61
62LUAI_FUNC int luaK_code (FuncState *fs, Instruction i); 62LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
63LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); 63LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned Bx);
64LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A, 64LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
65 int B, int C, int k); 65 int B, int C, int k);
66LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v); 66LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);
diff --git a/llimits.h b/llimits.h
index 3bcd1b7f..2adbd32e 100644
--- a/llimits.h
+++ b/llimits.h
@@ -91,7 +91,7 @@ typedef signed char ls_byte;
91#define L_P2I size_t 91#define L_P2I size_t
92#endif 92#endif
93 93
94#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX)) 94#define point2uint(p) cast_uint((L_P2I)(p) & UINT_MAX)
95 95
96 96
97 97
diff --git a/lstate.c b/lstate.c
index 2ae76d8c..c3422589 100644
--- a/lstate.c
+++ b/lstate.c
@@ -320,7 +320,7 @@ LUA_API int lua_closethread (lua_State *L, lua_State *from) {
320} 320}
321 321
322 322
323LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned int seed) { 323LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned seed) {
324 int i; 324 int i;
325 lua_State *L; 325 lua_State *L;
326 global_State *g; 326 global_State *g;
diff --git a/lstring.c b/lstring.c
index 9570e798..a374c965 100644
--- a/lstring.c
+++ b/lstring.c
@@ -40,7 +40,7 @@ int luaS_eqlngstr (TString *a, TString *b) {
40} 40}
41 41
42 42
43unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { 43unsigned luaS_hash (const char *str, size_t l, unsigned seed) {
44 unsigned int h = seed ^ cast_uint(l); 44 unsigned int h = seed ^ cast_uint(l);
45 for (; l > 0; l--) 45 for (; l > 0; l--)
46 h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1])); 46 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) {
48} 48}
49 49
50 50
51unsigned int luaS_hashlongstr (TString *ts) { 51unsigned luaS_hashlongstr (TString *ts) {
52 lua_assert(ts->tt == LUA_VLNGSTR); 52 lua_assert(ts->tt == LUA_VLNGSTR);
53 if (ts->extra == 0) { /* no hash? */ 53 if (ts->extra == 0) { /* no hash? */
54 size_t len = ts->u.lnglen; 54 size_t len = ts->u.lnglen;
@@ -155,7 +155,7 @@ size_t luaS_sizelngstr (size_t len, int kind) {
155** creates a new string object 155** creates a new string object
156*/ 156*/
157static TString *createstrobj (lua_State *L, size_t totalsize, int tag, 157static TString *createstrobj (lua_State *L, size_t totalsize, int tag,
158 unsigned int h) { 158 unsigned h) {
159 TString *ts; 159 TString *ts;
160 GCObject *o; 160 GCObject *o;
161 o = luaC_newobj(L, tag, totalsize); 161 o = luaC_newobj(L, tag, totalsize);
diff --git a/lstring.h b/lstring.h
index e321bd43..b7226d83 100644
--- a/lstring.h
+++ b/lstring.h
@@ -43,8 +43,8 @@
43#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) 43#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
44 44
45 45
46LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 46LUAI_FUNC unsigned luaS_hash (const char *str, size_t l, unsigned seed);
47LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 47LUAI_FUNC unsigned luaS_hashlongstr (TString *ts);
48LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 48LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
49LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 49LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
50LUAI_FUNC void luaS_clearcache (global_State *g); 50LUAI_FUNC void luaS_clearcache (global_State *g);
diff --git a/ltable.c b/ltable.c
index f62f36bc..ef19a5c5 100644
--- a/ltable.c
+++ b/ltable.c
@@ -358,8 +358,8 @@ static unsigned int arrayindex (lua_Integer k) {
358** elements in the array part, then elements in the hash part. The 358** elements in the array part, then elements in the hash part. The
359** beginning of a traversal is signaled by 0. 359** beginning of a traversal is signaled by 0.
360*/ 360*/
361static unsigned int findindex (lua_State *L, Table *t, TValue *key, 361static unsigned findindex (lua_State *L, Table *t, TValue *key,
362 unsigned int asize) { 362 unsigned asize) {
363 unsigned int i; 363 unsigned int i;
364 if (ttisnil(key)) return 0; /* first iteration */ 364 if (ttisnil(key)) return 0; /* first iteration */
365 i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0; 365 i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0;
@@ -462,7 +462,7 @@ static int keyinarray (Table *t, lua_Integer key) {
462** will go to the array part; return the optimal size. (The condition 462** will go to the array part; return the optimal size. (The condition
463** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.) 463** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.)
464*/ 464*/
465static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { 465static unsigned computesizes (unsigned nums[], unsigned *pna) {
466 int i; 466 int i;
467 unsigned int twotoi; /* 2^i (candidate for optimal size) */ 467 unsigned int twotoi; /* 2^i (candidate for optimal size) */
468 unsigned int a = 0; /* number of elements smaller than 2^i */ 468 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) {
506** number of keys that will go into corresponding slice and return 506** number of keys that will go into corresponding slice and return
507** total number of non-nil keys. 507** total number of non-nil keys.
508*/ 508*/
509static unsigned int numusearray (const Table *t, unsigned int *nums) { 509static unsigned numusearray (const Table *t, unsigned *nums) {
510 int lg; 510 int lg;
511 unsigned int ttlg; /* 2^lg */ 511 unsigned int ttlg; /* 2^lg */
512 unsigned int ause = 0; /* summation of 'nums' */ 512 unsigned int ause = 0; /* summation of 'nums' */
@@ -533,7 +533,7 @@ static unsigned int numusearray (const Table *t, unsigned int *nums) {
533} 533}
534 534
535 535
536static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { 536static int numusehash (const Table *t, unsigned *nums, unsigned *pna) {
537 int totaluse = 0; /* total number of elements */ 537 int totaluse = 0; /* total number of elements */
538 int ause = 0; /* elements added to 'nums' (can go to array part) */ 538 int ause = 0; /* elements added to 'nums' (can go to array part) */
539 int i = sizenode(t); 539 int i = sizenode(t);
@@ -567,8 +567,8 @@ static size_t concretesize (unsigned int size) {
567 567
568 568
569static ArrayCell *resizearray (lua_State *L , Table *t, 569static ArrayCell *resizearray (lua_State *L , Table *t,
570 unsigned int oldasize, 570 unsigned oldasize,
571 unsigned int newasize) { 571 unsigned newasize) {
572 size_t oldasizeb = concretesize(oldasize); 572 size_t oldasizeb = concretesize(oldasize);
573 size_t newasizeb = concretesize(newasize); 573 size_t newasizeb = concretesize(newasize);
574 void *a = luaM_reallocvector(L, t->array, oldasizeb, newasizeb, lu_byte); 574 void *a = luaM_reallocvector(L, t->array, oldasizeb, newasizeb, lu_byte);
@@ -583,7 +583,7 @@ static ArrayCell *resizearray (lua_State *L , Table *t,
583** comparison ensures that the shift in the second one does not 583** comparison ensures that the shift in the second one does not
584** overflow. 584** overflow.
585*/ 585*/
586static void setnodevector (lua_State *L, Table *t, unsigned int size) { 586static void setnodevector (lua_State *L, Table *t, unsigned size) {
587 if (size == 0) { /* no elements to hash part? */ 587 if (size == 0) { /* no elements to hash part? */
588 t->node = cast(Node *, dummynode); /* use common 'dummynode' */ 588 t->node = cast(Node *, dummynode); /* use common 'dummynode' */
589 t->lsizenode = 0; 589 t->lsizenode = 0;
@@ -695,8 +695,8 @@ static void clearNewSlice (Table *t, unsigned oldasize, unsigned newasize) {
695** nils and reinserts the elements of the old hash back into the new 695** nils and reinserts the elements of the old hash back into the new
696** parts of the table. 696** parts of the table.
697*/ 697*/
698void luaH_resize (lua_State *L, Table *t, unsigned int newasize, 698void luaH_resize (lua_State *L, Table *t, unsigned newasize,
699 unsigned int nhsize) { 699 unsigned nhsize) {
700 Table newt; /* to keep the new hash part */ 700 Table newt; /* to keep the new hash part */
701 unsigned int oldasize = setlimittosize(t); 701 unsigned int oldasize = setlimittosize(t);
702 ArrayCell *newarray; 702 ArrayCell *newarray;
diff --git a/ltable.h b/ltable.h
index 1f2ea3ee..4734bd50 100644
--- a/ltable.h
+++ b/ltable.h
@@ -151,13 +151,13 @@ LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key,
151LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, 151LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
152 TValue *value, int hres); 152 TValue *value, int hres);
153LUAI_FUNC Table *luaH_new (lua_State *L); 153LUAI_FUNC Table *luaH_new (lua_State *L);
154LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 154LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned nasize,
155 unsigned int nhsize); 155 unsigned nhsize);
156LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); 156LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned nasize);
157LUAI_FUNC void luaH_free (lua_State *L, Table *t); 157LUAI_FUNC void luaH_free (lua_State *L, Table *t);
158LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 158LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
159LUAI_FUNC lua_Unsigned luaH_getn (Table *t); 159LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
160LUAI_FUNC unsigned int luaH_realasize (const Table *t); 160LUAI_FUNC unsigned luaH_realasize (const Table *t);
161 161
162 162
163#if defined(LUA_DEBUG) 163#if defined(LUA_DEBUG)
diff --git a/ltablib.c b/ltablib.c
index 4c3f6900..a402daea 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -329,8 +329,7 @@ static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
329/* 329/*
330** Quicksort algorithm (recursive function) 330** Quicksort algorithm (recursive function)
331*/ 331*/
332static void auxsort (lua_State *L, IdxT lo, IdxT up, 332static void auxsort (lua_State *L, IdxT lo, IdxT up, unsigned rnd) {
333 unsigned int rnd) {
334 while (lo < up) { /* loop for tail recursion */ 333 while (lo < up) { /* loop for tail recursion */
335 IdxT p; /* Pivot index */ 334 IdxT p; /* Pivot index */
336 IdxT n; /* to be used later */ 335 IdxT n; /* to be used later */
diff --git a/ltests.c b/ltests.c
index 1a34870e..4780673e 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1008,7 +1008,7 @@ static int table_query (lua_State *L) {
1008 lua_pushinteger(L, t->alimit); 1008 lua_pushinteger(L, t->alimit);
1009 return 3; 1009 return 3;
1010 } 1010 }
1011 else if ((unsigned int)i < asize) { 1011 else if (cast_uint(i) < asize) {
1012 lua_pushinteger(L, i); 1012 lua_pushinteger(L, i);
1013 arr2obj(t, i + 1, s2v(L->top.p)); 1013 arr2obj(t, i + 1, s2v(L->top.p));
1014 api_incr_top(L); 1014 api_incr_top(L);