From d30f18947a5c5e275ef7f17323ac837939cb0135 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 12 May 2019 16:04:15 +1000 Subject: % More work on Advanced Mufflers. --- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Java/gtPlusPlus/core/util/math') diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 3cef3c511f..bda722b47e 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -7,6 +7,7 @@ import gregtech.api.enums.GT_Values; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -227,7 +228,7 @@ public class MathUtils { * @param x Value A. * @return boolean Whether or not it divides evenly. */ - public static boolean isNumberEven(final int x){ + public static boolean isNumberEven(final long x){ if ((x % 2) == 0) { return true; @@ -696,5 +697,11 @@ public class MathUtils { int aAmount = Math.max(Math.min(i, aMax), aMin); return aAmount; } + + public static Pair splitLongIntoIntegers(long aLong){ + int aIntMaxInLong = (int) Math.min(Integer.MAX_VALUE, Math.floor(aLong/Integer.MAX_VALUE)); + int aRemainder = (int) (aLong - (aIntMaxInLong * Integer.MAX_VALUE)); + return new Pair(aIntMaxInLong, aRemainder); + } } -- cgit