Skip to content

Commit 1047e9e

Browse files
dfa1claude
andcommitted
test(reader): drop redundant Math.max alloc guards in TestArrays
allocate(0, n) is legal and tested (empty bytes/bools cases), so the Math.max(1, ...) floors were dead code that made bytes()/bools() diverge from the other builders. Remove for consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 0acaf5b commit 1047e9e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

reader/src/test/java/io/github/dfa1/vortex/reader/array/TestArrays.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static ShortArray shorts(short... vs) {
8383
/// @param vs element values
8484
/// @return read-only materialized byte array
8585
public static ByteArray bytes(byte... vs) {
86-
MemorySegment seg = Arena.ofAuto().allocate(Math.max(1, vs.length), 1);
86+
MemorySegment seg = Arena.ofAuto().allocate(vs.length, 1);
8787
for (int i = 0; i < vs.length; i++) {
8888
seg.set(ValueLayout.JAVA_BYTE, i, vs[i]);
8989
}
@@ -95,7 +95,7 @@ public static ByteArray bytes(byte... vs) {
9595
/// @param vs element values
9696
/// @return read-only materialized bool array
9797
public static BoolArray bools(boolean... vs) {
98-
MemorySegment seg = Arena.ofAuto().allocate(Math.max(1, (vs.length + 7) / 8), 1);
98+
MemorySegment seg = Arena.ofAuto().allocate((vs.length + 7) / 8, 1);
9999
for (int i = 0; i < vs.length; i++) {
100100
if (vs[i]) {
101101
long byteIdx = i >>> 3;

0 commit comments

Comments
 (0)