From 43d7e8124e0e6b79048bc447dc2667c325b41507 Mon Sep 17 00:00:00 2001 From: SirYwell Date: Thu, 26 Jan 2023 10:14:47 +0100 Subject: [PATCH] Use ceilDiv --- .../fastasyncworldedit/core/util/io/MemoryFileSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/io/MemoryFileSupport.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/io/MemoryFileSupport.java index 4193d0bb5..4df78f50e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/io/MemoryFileSupport.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/io/MemoryFileSupport.java @@ -23,8 +23,7 @@ final class MemoryFileSupport { static long requiredBytes(int bitsPerEntry, long entries) { long bitsNeeded = bitsPerEntry * entries; - // Math.ceilDiv is Java 18+ - return -Math.floorDiv(-bitsNeeded, 8) + MemoryFileSupport.PADDING; + return MathMan.ceilDiv(bitsNeeded, 8) + MemoryFileSupport.PADDING; } static int bitsPerEntry(int valueCount) { @@ -38,4 +37,5 @@ final class MemoryFileSupport { static @Range(from = 0, to = 7) int shift(long bitPos, long bytePos) { return (int) (bitPos - (bytePos << 3)); } + }