mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed duplicate implementation in round() script function
* C++11 lroundf can do the same thing.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user