mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-14 09:47:24 +07:00
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.
This commit is contained in:
@ -15,18 +15,18 @@ public enum LogicOp{
|
|||||||
greaterThan(">", (a, b) -> a > b ? 1 : 0),
|
greaterThan(">", (a, b) -> a > b ? 1 : 0),
|
||||||
greaterThanEq(">=", (a, b) -> a >= b ? 1 : 0),
|
greaterThanEq(">=", (a, b) -> a >= b ? 1 : 0),
|
||||||
pow("^", Math::pow),
|
pow("^", Math::pow),
|
||||||
shl(">>", (a, b) -> (int)a >> (int)b),
|
shl(">>", (a, b) -> (long)a >> (long)b),
|
||||||
shr("<<", (a, b) -> (int)a << (int)b),
|
shr("<<", (a, b) -> (long)a << (long)b),
|
||||||
or("or", (a, b) -> (int)a | (int)b),
|
or("or", (a, b) -> (long)a | (long)b),
|
||||||
and("and", (a, b) -> (int)a & (int)b),
|
and("and", (a, b) -> (long)a & (long)b),
|
||||||
xor("xor", (a, b) -> (int)a ^ (int)b),
|
xor("xor", (a, b) -> (long)a ^ (long)b),
|
||||||
max("max", Math::max),
|
max("max", Math::max),
|
||||||
min("min", Math::min),
|
min("min", Math::min),
|
||||||
atan2("atan2", (x, y) -> Mathf.atan2((float)x, (float)y) * Mathf.radDeg),
|
atan2("atan2", (x, y) -> Mathf.atan2((float)x, (float)y) * Mathf.radDeg),
|
||||||
dst("dst", (x, y) -> Mathf.dst((float)x, (float)y)),
|
dst("dst", (x, y) -> Mathf.dst((float)x, (float)y)),
|
||||||
noise("noise", LExecutor.noise::rawNoise2D),
|
noise("noise", LExecutor.noise::rawNoise2D),
|
||||||
|
|
||||||
not("not", a -> ~(int)(a)),
|
not("not", a -> ~(long)(a)),
|
||||||
abs("abs", a -> Math.abs(a)),
|
abs("abs", a -> Math.abs(a)),
|
||||||
log("log", Math::log),
|
log("log", Math::log),
|
||||||
log10("log10", Math::log10),
|
log10("log10", Math::log10),
|
||||||
|
Reference in New Issue
Block a user