Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-17 00:20:09 +01:00
Use ceilDiv
Dieser Commit ist enthalten in:
Ursprung
8436e73ab1
Commit
43d7e8124e
@ -23,8 +23,7 @@ final class MemoryFileSupport {
|
|||||||
|
|
||||||
static long requiredBytes(int bitsPerEntry, long entries) {
|
static long requiredBytes(int bitsPerEntry, long entries) {
|
||||||
long bitsNeeded = bitsPerEntry * entries;
|
long bitsNeeded = bitsPerEntry * entries;
|
||||||
// Math.ceilDiv is Java 18+
|
return MathMan.ceilDiv(bitsNeeded, 8) + MemoryFileSupport.PADDING;
|
||||||
return -Math.floorDiv(-bitsNeeded, 8) + MemoryFileSupport.PADDING;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bitsPerEntry(int valueCount) {
|
static int bitsPerEntry(int valueCount) {
|
||||||
@ -38,4 +37,5 @@ final class MemoryFileSupport {
|
|||||||
static @Range(from = 0, to = 7) int shift(long bitPos, long bytePos) {
|
static @Range(from = 0, to = 7) int shift(long bitPos, long bytePos) {
|
||||||
return (int) (bitPos - (bytePos << 3));
|
return (int) (bitPos - (bytePos << 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren