aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-01-31 11:09:53 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-01-31 11:09:53 -0300
commit46c3587a6feb28e1ee4a32aabe463b0ecb9e8f5e (patch)
tree7e1ae9b55536171511506532a04f4ebe6dc764b0 /lvm.c
parent69c7139ff88bf26e05d80bf19d0351e5c88d13a3 (diff)
downloadlua-46c3587a6feb28e1ee4a32aabe463b0ecb9e8f5e.tar.gz
lua-46c3587a6feb28e1ee4a32aabe463b0ecb9e8f5e.tar.bz2
lua-46c3587a6feb28e1ee4a32aabe463b0ecb9e8f5e.zip
Clearer distinction between types and tags
LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lvm.c b/lvm.c
index 656def81..9c1ad47e 100644
--- a/lvm.c
+++ b/lvm.c
@@ -577,14 +577,14 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
577 } 577 }
578 /* values have same type and same variant */ 578 /* values have same type and same variant */
579 switch (ttypetag(t1)) { 579 switch (ttypetag(t1)) {
580 case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE: return 1; 580 case LUA_VNIL: case LUA_VFALSE: case LUA_VTRUE: return 1;
581 case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); 581 case LUA_VNUMINT: return (ivalue(t1) == ivalue(t2));
582 case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); 582 case LUA_VNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2));
583 case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); 583 case LUA_VLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
584 case LUA_TLCF: return fvalue(t1) == fvalue(t2); 584 case LUA_VLCF: return fvalue(t1) == fvalue(t2);
585 case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); 585 case LUA_VSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2));
586 case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); 586 case LUA_VLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2));
587 case LUA_TUSERDATA: { 587 case LUA_VUSERDATA: {
588 if (uvalue(t1) == uvalue(t2)) return 1; 588 if (uvalue(t1) == uvalue(t2)) return 1;
589 else if (L == NULL) return 0; 589 else if (L == NULL) return 0;
590 tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); 590 tm = fasttm(L, uvalue(t1)->metatable, TM_EQ);
@@ -592,7 +592,7 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
592 tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); 592 tm = fasttm(L, uvalue(t2)->metatable, TM_EQ);
593 break; /* will try TM */ 593 break; /* will try TM */
594 } 594 }
595 case LUA_TTABLE: { 595 case LUA_VTABLE: {
596 if (hvalue(t1) == hvalue(t2)) return 1; 596 if (hvalue(t1) == hvalue(t2)) return 1;
597 else if (L == NULL) return 0; 597 else if (L == NULL) return 0;
598 tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); 598 tm = fasttm(L, hvalue(t1)->metatable, TM_EQ);
@@ -680,18 +680,18 @@ void luaV_concat (lua_State *L, int total) {
680void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { 680void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
681 const TValue *tm; 681 const TValue *tm;
682 switch (ttypetag(rb)) { 682 switch (ttypetag(rb)) {
683 case LUA_TTABLE: { 683 case LUA_VTABLE: {
684 Table *h = hvalue(rb); 684 Table *h = hvalue(rb);
685 tm = fasttm(L, h->metatable, TM_LEN); 685 tm = fasttm(L, h->metatable, TM_LEN);
686 if (tm) break; /* metamethod? break switch to call it */ 686 if (tm) break; /* metamethod? break switch to call it */
687 setivalue(s2v(ra), luaH_getn(h)); /* else primitive len */ 687 setivalue(s2v(ra), luaH_getn(h)); /* else primitive len */
688 return; 688 return;
689 } 689 }
690 case LUA_TSHRSTR: { 690 case LUA_VSHRSTR: {
691 setivalue(s2v(ra), tsvalue(rb)->shrlen); 691 setivalue(s2v(ra), tsvalue(rb)->shrlen);
692 return; 692 return;
693 } 693 }
694 case LUA_TLNGSTR: { 694 case LUA_VLNGSTR: {
695 setivalue(s2v(ra), tsvalue(rb)->u.lnglen); 695 setivalue(s2v(ra), tsvalue(rb)->u.lnglen);
696 return; 696 return;
697 } 697 }