Skip to content

Commit c1af057

Browse files
committed
remove unused fOrderIndex and cOrderIndex
1 parent 8095b13 commit c1af057

3 files changed

Lines changed: 0 additions & 46 deletions

File tree

src/main/java/dev/zarr/zarrjava/utils/IndexingUtils.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -116,31 +116,6 @@ public static ChunkProjection computeProjection(
116116
return new ChunkProjection(chunkCoords, chunkOffset, outOffset, shape);
117117
}
118118

119-
120-
public static long cOrderIndex(final long[] chunkCoords, final long[] arrayShape) {
121-
long index = 0;
122-
long multiplier = 1;
123-
124-
for (int i = arrayShape.length - 1; i >= 0; i--) {
125-
index += chunkCoords[i] * multiplier;
126-
multiplier *= arrayShape[i];
127-
}
128-
129-
return index;
130-
}
131-
132-
public static long fOrderIndex(final long[] chunkCoords, final long[] arrayShape) {
133-
long index = 0;
134-
long multiplier = 1;
135-
136-
for (int i = 0; i < arrayShape.length; i++) {
137-
index += chunkCoords[i] * multiplier;
138-
multiplier *= arrayShape[i];
139-
}
140-
141-
return index;
142-
}
143-
144119
public static boolean isFullChunk(final int[] selOffset, final int[] selShape,
145120
final int[] chunkShape) {
146121
if (selOffset.length != selShape.length) {

src/main/java/dev/zarr/zarrjava/v3/codec/core/ShardingIndexedCodec.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ public ByteBuffer encode(final Array shardArray) throws ZarrException {
119119
.forEach(
120120
chunkCoords -> {
121121
try {
122-
final int i =
123-
(int) IndexingUtils.cOrderIndex(chunkCoords, Utils.toLongArray(chunksPerShard));
124122
final IndexingUtils.ChunkProjection chunkProjection =
125123
IndexingUtils.computeProjection(chunkCoords, shardMetadata.shape,
126124
shardMetadata.chunkShape

src/test/java/dev/zarr/zarrjava/TestUtils.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,6 @@ public void testComputeProjection(){
7676
Assertions.assertArrayEquals(new int[]{1, 17}, projection.shape);
7777
}
7878

79-
@Test
80-
public void testFOrderIndexOverflow() {
81-
// Create a shape that fits in long but would cause int overflow in fOrderIndex
82-
// Shape: [2000, 2000, 1000] -> Total elements = 4,000,000,000 (exceeds Integer.MAX_VALUE 2.14B)
83-
long[] arrayShape = {2000, 2000, 1000};
84-
85-
// Target coordinates near the end
86-
long[] chunkCoords = {1999, 1999, 999};
87-
88-
// Expected index should be large (approx 4 billion)
89-
long expectedIndex = 1999 +
90-
1999 * 2000L +
91-
999 * 2000L * 2000L;
92-
93-
long actualIndex = IndexingUtils.fOrderIndex(chunkCoords, arrayShape);
94-
95-
Assertions.assertEquals(expectedIndex, actualIndex, "fOrderIndex failed due to integer overflow");
96-
}
97-
9879
@Test
9980
public void testComputeChunkCoordsOverflow() {
10081
// Shape: [100000, 100000]

0 commit comments

Comments
 (0)