From 007a0da40aeea4e83b9a1923f794976507daede2 Mon Sep 17 00:00:00 2001 From: LordChrom <42330575+LordChrom@users.noreply.github.com> Date: Thu, 10 Sep 2020 18:14:03 -0500 Subject: [PATCH] Bugfix for Logic Ops (#2535) Performing some operations on larger numbers gave erroneous results when converting from doubles to ints. Now uses longs instead, which should help. --- core/src/mindustry/logic/LogicOp.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/logic/LogicOp.java b/core/src/mindustry/logic/LogicOp.java index 54e4351624..126f5bd607 100644 --- a/core/src/mindustry/logic/LogicOp.java +++ b/core/src/mindustry/logic/LogicOp.java @@ -15,18 +15,18 @@ public enum LogicOp{ greaterThan(">", (a, b) -> a > b ? 1 : 0), greaterThanEq(">=", (a, b) -> a >= b ? 1 : 0), pow("^", Math::pow), - shl(">>", (a, b) -> (int)a >> (int)b), - shr("<<", (a, b) -> (int)a << (int)b), - or("or", (a, b) -> (int)a | (int)b), - and("and", (a, b) -> (int)a & (int)b), - xor("xor", (a, b) -> (int)a ^ (int)b), + shl(">>", (a, b) -> (long)a >> (long)b), + shr("<<", (a, b) -> (long)a << (long)b), + or("or", (a, b) -> (long)a | (long)b), + and("and", (a, b) -> (long)a & (long)b), + xor("xor", (a, b) -> (long)a ^ (long)b), max("max", Math::max), min("min", Math::min), atan2("atan2", (x, y) -> Mathf.atan2((float)x, (float)y) * Mathf.radDeg), dst("dst", (x, y) -> Mathf.dst((float)x, (float)y)), noise("noise", LExecutor.noise::rawNoise2D), - not("not", a -> ~(int)(a)), + not("not", a -> ~(long)(a)), abs("abs", a -> Math.abs(a)), log("log", Math::log), log10("log10", Math::log10),