diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 02510524e21..ba1db831c47 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -82,6 +82,8 @@ static const FLOP FxFlops[] = { NAME_CosH, FLOP_COSH, [](double v) { return g_cosh(v); } }, { NAME_SinH, FLOP_SINH, [](double v) { return g_sinh(v); } }, { NAME_TanH, FLOP_TANH, [](double v) { return g_tanh(v); } }, + + { NAME_Round, FLOP_ROUND, [](double v) { return round(v); } }, }; diff --git a/src/scripting/backend/vmdisasm.cpp b/src/scripting/backend/vmdisasm.cpp index ebde2ef574f..0046bd7273c 100644 --- a/src/scripting/backend/vmdisasm.cpp +++ b/src/scripting/backend/vmdisasm.cpp @@ -181,6 +181,8 @@ static const char *const FlopNames[] = "cosh", "sinh", "tanh", + + "round", }; static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const VMScriptFunction *func); diff --git a/src/scripting/vm/jit_math.cpp b/src/scripting/vm/jit_math.cpp index 6c814a55067..4210fa6ff7d 100644 --- a/src/scripting/vm/jit_math.cpp +++ b/src/scripting/vm/jit_math.cpp @@ -985,6 +985,7 @@ void JitCompiler::EmitFLOP() case FLOP_COSH: func = g_cosh; break; case FLOP_SINH: func = g_sinh; break; case FLOP_TANH: func = g_tanh; break; + case FLOP_ROUND: func = round; break; } auto result = newResultXmmSd(); diff --git a/src/scripting/vm/vmexec.h b/src/scripting/vm/vmexec.h index 1aeea610aa0..1d3e6411f9b 100644 --- a/src/scripting/vm/vmexec.h +++ b/src/scripting/vm/vmexec.h @@ -1741,6 +1741,8 @@ static double DoFLOP(int flop, double v) case FLOP_COSH: return g_cosh(v); case FLOP_SINH: return g_sinh(v); case FLOP_TANH: return g_tanh(v); + + case FLOP_ROUND: return round(v); } assert(0); return 0; diff --git a/src/scripting/vm/vmintern.h b/src/scripting/vm/vmintern.h index feb422528af..b93f3e6ef5d 100644 --- a/src/scripting/vm/vmintern.h +++ b/src/scripting/vm/vmintern.h @@ -101,6 +101,8 @@ enum FLOP_COSH, FLOP_SINH, FLOP_TANH, + + FLOP_ROUND, }; // Cast operations diff --git a/src/utility/namedef.h b/src/utility/namedef.h index 0191bd41783..ec9d4b6bd63 100644 --- a/src/utility/namedef.h +++ b/src/utility/namedef.h @@ -363,6 +363,7 @@ xx(Tan) xx(CosH) xx(SinH) xx(TanH) +xx(Round) xx(ATan2) xx(VectorAngle) xx(New)