Changed internal representation of booleans

Instead of an explicit value (field 'b'), true and false use different
tag variants. This avoids reading an extra field and results in more
direct code. (Most code that uses booleans needs to distinguish between
true and false anyway.)
This commit is contained in:
Roberto Ierusalimschy
2020-01-06 11:38:31 -03:00
parent e3c83835e7
commit 5ff408d218
14 changed files with 87 additions and 52 deletions

View File

@@ -113,10 +113,7 @@ static void DumpConstants (const Proto *f, DumpState *D) {
const TValue *o = &f->k[i];
DumpByte(ttypetag(o), D);
switch (ttypetag(o)) {
case LUA_TNIL:
break;
case LUA_TBOOLEAN:
DumpByte(bvalue(o), D);
case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE:
break;
case LUA_TNUMFLT:
DumpNumber(fltvalue(o), D);