Removed duplicate implementation in round() script function

* C++11 lroundf can do the same thing.
This commit is contained in:
NovaRain
2024-05-12 13:53:45 +08:00
parent 44aafc757a
commit d6dc179df7
+1 -6
View File
@@ -96,12 +96,7 @@ void op_ceil(OpcodeContext& ctx) {
}
void op_round(OpcodeContext& ctx) {
float arg = ctx.arg(0).asFloat();
int argI = static_cast<int>(arg);
float mod = arg - static_cast<float>(argI);
if (abs(mod) >= 0.5) argI += (mod > 0 ? 1 : -1);
ctx.setReturn(argI);
ctx.setReturn(lroundf(ctx.arg(0).asFloat()));
}
void mf_floor2(OpcodeContext& ctx) {