MSVC warning C4244 fixes (#308)

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
This commit is contained in:
rafa_br34 2022-01-12 15:05:31 -03:00 committed by GitHub
parent b7a7b92d12
commit b7f78f4997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -714,7 +714,7 @@ void BytecodeBuilder::writeLineInfo(std::string& ss) const
// third pass: write resulting data // third pass: write resulting data
int logspan = log2(span); int logspan = log2(span);
writeByte(ss, logspan); writeByte(ss, uint8_t(logspan));
uint8_t lastOffset = 0; uint8_t lastOffset = 0;
@ -723,8 +723,8 @@ void BytecodeBuilder::writeLineInfo(std::string& ss) const
int delta = lines[i] - baseline[i >> logspan]; int delta = lines[i] - baseline[i >> logspan];
LUAU_ASSERT(delta >= 0 && delta <= 255); LUAU_ASSERT(delta >= 0 && delta <= 255);
writeByte(ss, delta - lastOffset); writeByte(ss, uint8_t(delta) - lastOffset);
lastOffset = delta; lastOffset = uint8_t(delta);
} }
int lastLine = 0; int lastLine = 0;

View File

@ -364,12 +364,12 @@ struct Compiler
else else
{ {
args[i] = uint8_t(regs + 1 + i); args[i] = uint8_t(regs + 1 + i);
compileExprTempTop(expr->args.data[i], args[i]); compileExprTempTop(expr->args.data[i], uint8_t(args[i]));
} }
} }
fastcallLabel = bytecode.emitLabel(); fastcallLabel = bytecode.emitLabel();
bytecode.emitABC(opc, uint8_t(bfid), args[0], 0); bytecode.emitABC(opc, uint8_t(bfid), uint8_t(args[0]), 0);
if (opc != LOP_FASTCALL1) if (opc != LOP_FASTCALL1)
bytecode.emitAux(args[1]); bytecode.emitAux(args[1]);
@ -385,7 +385,7 @@ struct Compiler
} }
if (args[i] != regs + 1 + i) if (args[i] != regs + 1 + i)
bytecode.emitABC(LOP_MOVE, uint8_t(regs + 1 + i), args[i], 0); bytecode.emitABC(LOP_MOVE, uint8_t(regs + 1 + i), uint8_t(args[i]), 0);
} }
} }
else else
@ -471,7 +471,7 @@ struct Compiler
if (cid >= 0 && cid < 32768) if (cid >= 0 && cid < 32768)
{ {
bytecode.emitAD(LOP_DUPCLOSURE, target, cid); bytecode.emitAD(LOP_DUPCLOSURE, target, int16_t(cid));
shared = true; shared = true;
} }
} }
@ -493,7 +493,7 @@ struct Compiler
// get local variable // get local variable
uint8_t reg = getLocal(uv); uint8_t reg = getLocal(uv);
bytecode.emitABC(LOP_CAPTURE, immutable ? LCT_VAL : LCT_REF, reg, 0); bytecode.emitABC(LOP_CAPTURE, uint8_t(immutable ? LCT_VAL : LCT_REF), reg, 0);
} }
else else
{ {
@ -635,7 +635,7 @@ struct Compiler
if (expr->op == AstExprBinary::CompareGt || expr->op == AstExprBinary::CompareGe) if (expr->op == AstExprBinary::CompareGt || expr->op == AstExprBinary::CompareGe)
{ {
bytecode.emitAD(opc, rr, 0); bytecode.emitAD(opc, uint8_t(rr), 0);
bytecode.emitAux(rl); bytecode.emitAux(rl);
} }
else else
@ -1144,7 +1144,7 @@ struct Compiler
} }
else else
{ {
bytecode.emitABC(LOP_NEWTABLE, reg, encodedHashSize, 0); bytecode.emitABC(LOP_NEWTABLE, reg, uint8_t(encodedHashSize), 0);
bytecode.emitAux(0); bytecode.emitAux(0);
} }
} }
@ -1157,7 +1157,7 @@ struct Compiler
bool trailingVarargs = last && last->kind == AstExprTable::Item::List && last->value->is<AstExprVarargs>(); bool trailingVarargs = last && last->kind == AstExprTable::Item::List && last->value->is<AstExprVarargs>();
LUAU_ASSERT(!trailingVarargs || arraySize > 0); LUAU_ASSERT(!trailingVarargs || arraySize > 0);
bytecode.emitABC(LOP_NEWTABLE, reg, encodedHashSize, 0); bytecode.emitABC(LOP_NEWTABLE, reg, uint8_t(encodedHashSize), 0);
bytecode.emitAux(arraySize - trailingVarargs + indexSize); bytecode.emitAux(arraySize - trailingVarargs + indexSize);
} }