FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Some 'unsigned int' changed to 'unsigned' · lua/lua@9fa63a6 · GitHub

/ lua Public

Commit 9fa63a6

Browse files
committed
Some 'unsigned int' changed to 'unsigned'
'unsigned int' is too long sometimes. (We already write 'long' instead of 'long int'...)
1 parent 0593256 commit 9fa63a6

9 files changed

Lines changed: 24 additions & 25 deletions

File tree

‎lcode.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
6060
#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
6161

6262
LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
63-
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
63+
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned Bx);
6464
LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
6565
int B, int C, int k);
6666
LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);

‎llimits.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ typedef signed char ls_byte;
9191
#define L_P2I size_t
9292
#endif
9393

94-
#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX))
94+
#define point2uint(p) cast_uint((L_P2I)(p) & UINT_MAX)
9595

9696

9797

‎lstate.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ LUA_API int lua_closethread (lua_State *L, lua_State *from) {
320320
}
321321

322322

323-
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned int seed) {
323+
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud, unsigned seed) {
324324
int i;
325325
lua_State *L;
326326
global_State *g;

‎lstring.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ int luaS_eqlngstr (TString *a, TString *b) {
4040
}
4141

4242

43-
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
43+
unsigned luaS_hash (const char *str, size_t l, unsigned seed) {
4444
unsigned int h = seed ^ cast_uint(l);
4545
for (; l > 0; l--)
4646
h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1]));
4747
return h;
4848
}
4949

5050

51-
unsigned int luaS_hashlongstr (TString *ts) {
51+
unsigned luaS_hashlongstr (TString *ts) {
5252
lua_assert(ts->tt == LUA_VLNGSTR);
5353
if (ts->extra == 0) { /* no hash? */
5454
size_t len = ts->u.lnglen;
@@ -155,7 +155,7 @@ size_t luaS_sizelngstr (size_t len, int kind) {
155155
** creates a new string object
156156
*/
157157
static TString *createstrobj (lua_State *L, size_t totalsize, int tag,
158-
unsigned int h) {
158+
unsigned h) {
159159
TString *ts;
160160
GCObject *o;
161161
o = luaC_newobj(L, tag, totalsize);

‎lstring.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
4444

4545

46-
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
47-
LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
46+
LUAI_FUNC unsigned luaS_hash (const char *str, size_t l, unsigned seed);
47+
LUAI_FUNC unsigned luaS_hashlongstr (TString *ts);
4848
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
4949
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
5050
LUAI_FUNC void luaS_clearcache (global_State *g);

‎ltable.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ static unsigned int arrayindex (lua_Integer k) {
358358
** elements in the array part, then elements in the hash part. The
359359
** beginning of a traversal is signaled by 0.
360360
*/
361-
static unsigned int findindex (lua_State *L, Table *t, TValue *key,
362-
unsigned int asize) {
361+
static unsigned findindex (lua_State *L, Table *t, TValue *key,
362+
unsigned asize) {
363363
unsigned int i;
364364
if (ttisnil(key)) return 0; /* first iteration */
365365
i = ttisinteger(key) ? arrayindex(ivalue(key)) : 0;
@@ -462,7 +462,7 @@ static int keyinarray (Table *t, lua_Integer key) {
462462
** will go to the array part; return the optimal size. (The condition
463463
** 'twotoi > 0' in the for loop stops the loop if 'twotoi' overflows.)
464464
*/
465-
static unsigned int computesizes (unsigned int nums[], unsigned int *pna) {
465+
static unsigned computesizes (unsigned nums[], unsigned *pna) {
466466
int i;
467467
unsigned int twotoi; /* 2^i (candidate for optimal size) */
468468
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) {
506506
** number of keys that will go into corresponding slice and return
507507
** total number of non-nil keys.
508508
*/
509-
static unsigned int numusearray (const Table *t, unsigned int *nums) {
509+
static unsigned numusearray (const Table *t, unsigned *nums) {
510510
int lg;
511511
unsigned int ttlg; /* 2^lg */
512512
unsigned int ause = 0; /* summation of 'nums' */
@@ -533,7 +533,7 @@ static unsigned int numusearray (const Table *t, unsigned int *nums) {
533533
}
534534

535535

536-
static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) {
536+
static int numusehash (const Table *t, unsigned *nums, unsigned *pna) {
537537
int totaluse = 0; /* total number of elements */
538538
int ause = 0; /* elements added to 'nums' (can go to array part) */
539539
int i = sizenode(t);
@@ -567,8 +567,8 @@ static size_t concretesize (unsigned int size) {
567567

568568

569569
static ArrayCell *resizearray (lua_State *L , Table *t,
570-
unsigned int oldasize,
571-
unsigned int newasize) {
570+
unsigned oldasize,
571+
unsigned newasize) {
572572
size_t oldasizeb = concretesize(oldasize);
573573
size_t newasizeb = concretesize(newasize);
574574
void *a = luaM_reallocvector(L, t->array, oldasizeb, newasizeb, lu_byte);
@@ -583,7 +583,7 @@ static ArrayCell *resizearray (lua_State *L , Table *t,
583583
** comparison ensures that the shift in the second one does not
584584
** overflow.
585585
*/
586-
static void setnodevector (lua_State *L, Table *t, unsigned int size) {
586+
static void setnodevector (lua_State *L, Table *t, unsigned size) {
587587
if (size == 0) { /* no elements to hash part? */
588588
t->node = cast(Node *, dummynode); /* use common 'dummynode' */
589589
t->lsizenode = 0;
@@ -695,8 +695,8 @@ static void clearNewSlice (Table *t, unsigned oldasize, unsigned newasize) {
695695
** nils and reinserts the elements of the old hash back into the new
696696
** parts of the table.
697697
*/
698-
void luaH_resize (lua_State *L, Table *t, unsigned int newasize,
699-
unsigned int nhsize) {
698+
void luaH_resize (lua_State *L, Table *t, unsigned newasize,
699+
unsigned nhsize) {
700700
Table newt; /* to keep the new hash part */
701701
unsigned int oldasize = setlimittosize(t);
702702
ArrayCell *newarray;

‎ltable.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key,
151151
LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
152152
TValue *value, int hres);
153153
LUAI_FUNC Table *luaH_new (lua_State *L);
154-
LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
155-
unsigned int nhsize);
156-
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
154+
LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned nasize,
155+
unsigned nhsize);
156+
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned nasize);
157157
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
158158
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
159159
LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
160-
LUAI_FUNC unsigned int luaH_realasize (const Table *t);
160+
LUAI_FUNC unsigned luaH_realasize (const Table *t);
161161

162162

163163
#if defined(LUA_DEBUG)

‎ltablib.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,7 @@ static IdxT choosePivot (IdxT lo, IdxT up, unsigned int rnd) {
329329
/*
330330
** Quicksort algorithm (recursive function)
331331
*/
332-
static void auxsort (lua_State *L, IdxT lo, IdxT up,
333-
unsigned int rnd) {
332+
static void auxsort (lua_State *L, IdxT lo, IdxT up, unsigned rnd) {
334333
while (lo < up) { /* loop for tail recursion */
335334
IdxT p; /* Pivot index */
336335
IdxT n; /* to be used later */

‎ltests.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ static int table_query (lua_State *L) {
10081008
lua_pushinteger(L, t->alimit);
10091009
return 3;
10101010
}
1011-
else if ((unsigned int)i < asize) {
1011+
else if (cast_uint(i) < asize) {
10121012
lua_pushinteger(L, i);
10131013
arr2obj(t, i + 1, s2v(L->top.p));
10141014
api_incr_top(L);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL