From f9e56f715d8ad8a658962cfcc6c3e5c232cd4ef1 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Mon, 25 Mar 2024 19:26:46 +0100 Subject: [PATCH] make method more complete --- .../bioimage/modelrunner/utils/CommonUtils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/bioimage/modelrunner/utils/CommonUtils.java b/src/main/java/io/bioimage/modelrunner/utils/CommonUtils.java index 78b95484..46f2f406 100644 --- a/src/main/java/io/bioimage/modelrunner/utils/CommonUtils.java +++ b/src/main/java/io/bioimage/modelrunner/utils/CommonUtils.java @@ -177,8 +177,8 @@ public static String getTime() { return dateString; } - public static boolean int32Overflows(int[] arr) { - double div = Integer.MAX_VALUE; + public static boolean int32Overflows(int[] arr, int bytesPerValue) { + double div = Integer.MAX_VALUE / bytesPerValue; for (int a : arr) div = div / (double) a; if (div < 1) @@ -186,8 +186,8 @@ public static boolean int32Overflows(int[] arr) { return false; } - public static boolean int32Overflows(long[] arr) { - double div = Integer.MAX_VALUE; + public static boolean int32Overflows(long[] arr, int bytesPerValue) { + double div = Integer.MAX_VALUE / bytesPerValue; for (long a : arr) div = div / (double) a; if (div < 1) @@ -195,8 +195,8 @@ public static boolean int32Overflows(long[] arr) { return false; } - public static boolean int64Overflows(int[] arr) { - double div = Long.MAX_VALUE; + public static boolean int64Overflows(int[] arr, int bytesPerValue) { + double div = Long.MAX_VALUE / bytesPerValue; for (int a : arr) div = div / (double) a; if (div < 1) @@ -204,8 +204,8 @@ public static boolean int64Overflows(int[] arr) { return false; } - public static boolean int64Overflows(long[] arr) { - double div = Long.MAX_VALUE; + public static boolean int64Overflows(long[] arr, int bytesPerValue) { + double div = Long.MAX_VALUE / bytesPerValue; for (long a : arr) div = div / (double) a; if (div < 1)