Skip to content

Commit

Permalink
Revert "feature: Add bit-shuffling interfaces for unshuffle with prov…
Browse files Browse the repository at this point in the history
…ided out…" (#640)

This reverts commit 4277fbc.
  • Loading branch information
xerial authored Feb 4, 2025
1 parent 466d05f commit 65e1ec3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 132 deletions.
104 changes: 0 additions & 104 deletions src/main/java/org/xerial/snappy/BitShuffle.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,35 +208,6 @@ public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original byte array.
*
* @param input
* @return a byte array
* @throws IOException
*/
public static byte[] unshuffleByteArray(byte[] input) throws IOException {
byte[] output = new byte[input.length];
int numProcessed = impl.unshuffle(input, 0, 1, input.length, output, 0);
assert(numProcessed == input.length);
return output;
}

/**
* Convert the input bit-shuffled byte array into an original byte array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleByteArray(byte[] input, byte[] output) throws IOException {
assert(input.length == output.length);
int numProcessed = impl.unshuffle(input, 0, 1, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original short array.
*
Expand All @@ -251,21 +222,6 @@ public static short[] unshuffleShortArray(byte[] input) throws IOException {
return output;
}

/**
* Convert the input bit-shuffled byte array into an original short array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleShortArray(byte[] input, short[] output) throws IOException {
assert(input.length == output.length * 2);
int numProcessed = impl.unshuffle(input, 0, 2, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original int array.
*
Expand All @@ -280,21 +236,6 @@ public static int[] unshuffleIntArray(byte[] input) throws IOException {
return output;
}

/**
* Convert the input bit-shuffled byte array into an original int array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleIntArray(byte[] input, int[] output) throws IOException {
assert(input.length == output.length * 4);
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original long array.
*
Expand All @@ -309,21 +250,6 @@ public static long[] unshuffleLongArray(byte[] input) throws IOException {
return output;
}

/**
* Convert the input bit-shuffled byte array into an original long array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleLongArray(byte[] input, long[] output) throws IOException {
assert(input.length == output.length * 8);
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original float array.
*
Expand All @@ -338,21 +264,6 @@ public static float[] unshuffleFloatArray(byte[] input) throws IOException {
return output;
}

/**
* Convert the input bit-shuffled byte array into an original float array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleFloatArray(byte[] input, float[] output) throws IOException {
assert(input.length == output.length * 4);
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}

/**
* Convert the input bit-shuffled byte array into an original double array.
*
Expand All @@ -366,19 +277,4 @@ public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
assert(numProcessed == input.length);
return output;
}

/**
* Convert the input bit-shuffled byte array into an original double array.
*
* @param input
* @param output
* @return byte size of the unshuffled data.
* @throws IOException
*/
public static int unshuffleDoubleArray(byte[] input, double[] output) throws IOException {
assert(input.length == output.length * 8);
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return numProcessed;
}
}
28 changes: 0 additions & 28 deletions src/test/java/org/xerial/snappy/BitShuffleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,6 @@ public void shuffleLongArray()
byte[] shuffledData = BitShuffle.shuffle(data);
long[] result = BitShuffle.unshuffleLongArray(shuffledData);
assertArrayEquals(data, result);
long[] output = new long[data.length];
BitShuffle.unshuffleLongArray(shuffledData, output);
assertArrayEquals(data, output);
}

@Test
public void shuffleByteArray()
throws Exception
{
byte[] data = new byte[] {43, -32, 1, 3, 34, 43, 34, Byte.MAX_VALUE, -1};
byte[] shuffledData = BitShuffle.shuffle(data);
byte[] result = BitShuffle.unshuffleByteArray(shuffledData);
assertArrayEquals(data, result);
byte[] output = new byte[data.length];
BitShuffle.unshuffleByteArray(shuffledData, output);
assertArrayEquals(data, output);
}

@Test
Expand All @@ -302,9 +286,6 @@ public void shuffleShortArray()
byte[] shuffledData = BitShuffle.shuffle(data);
short[] result = BitShuffle.unshuffleShortArray(shuffledData);
assertArrayEquals(data, result);
short[] output = new short[data.length];
BitShuffle.unshuffleShortArray(shuffledData, output);
assertArrayEquals(data, output);
}

@Test
Expand All @@ -315,9 +296,6 @@ public void shuffleIntArray()
byte[] shuffledData = BitShuffle.shuffle(data);
int[] result = BitShuffle.unshuffleIntArray(shuffledData);
assertArrayEquals(data, result);
int[] output = new int[data.length];
BitShuffle.unshuffleIntArray(shuffledData, output);
assertArrayEquals(data, output);
}

@Test
Expand All @@ -328,9 +306,6 @@ public void shuffleFloatArray()
byte[] shuffledData = BitShuffle.shuffle(data);
float[] result = BitShuffle.unshuffleFloatArray(shuffledData);
assertArrayEquals(data, result, 0.0000001f);
float[] output = new float[data.length];
BitShuffle.unshuffleFloatArray(shuffledData, output);
assertArrayEquals(data, output);
}

@Test
Expand All @@ -341,8 +316,5 @@ public void shuffleDoubleArray()
byte[] shuffledData = BitShuffle.shuffle(data);
double[] result = BitShuffle.unshuffleDoubleArray(shuffledData);
assertArrayEquals(data, result, 0.0000001f);
double[] output = new double[data.length];
BitShuffle.unshuffleDoubleArray(shuffledData, output);
assertArrayEquals(data, output);
}
}

0 comments on commit 65e1ec3

Please sign in to comment.