summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util/TestBitstream02.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-12-03 20:30:46 +0100
committerSven Gothel <[email protected]>2014-12-03 20:30:46 +0100
commit9e13e8c78ed69bb7afcd49abe8bf69340dc06223 (patch)
tree956c8bb0ab085e7325aa18400681be7612224dae /src/junit/com/jogamp/common/util/TestBitstream02.java
parentca4f075aeed16331f0b806ea564ca3d492039336 (diff)
Bug 1106 - Bitstream: Simplify 'msbFirst' case for bulk operations / Add setting of stream position (optional)
- Add setting position entry, optionally supported, e.g. ByteBufferStream and ByteArrayStream - Remove 'msbFirst' parameter on all 'bulk' read/write operations. These methods use LSB-first always, allowing proper stream access of data w/ different bit-sizes. Data is now read/write as little-endian and swapped accordingly. Optimizations are adopted for LSB-first operations. This change removes API confusion/bugs: - removes one decision (parameter) - removes the data reversion case - removes bugs w/ different bit-sizes
Diffstat (limited to 'src/junit/com/jogamp/common/util/TestBitstream02.java')
-rw-r--r--src/junit/com/jogamp/common/util/TestBitstream02.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/junit/com/jogamp/common/util/TestBitstream02.java b/src/junit/com/jogamp/common/util/TestBitstream02.java
index 3fb4cce..16904a2 100644
--- a/src/junit/com/jogamp/common/util/TestBitstream02.java
+++ b/src/junit/com/jogamp/common/util/TestBitstream02.java
@@ -71,17 +71,17 @@ public class TestBitstream02 extends SingletonJunitCase {
final Bitstream.ByteBufferStream bbs = new Bitstream.ByteBufferStream(bb);
final Bitstream<ByteBuffer> bs = new Bitstream<ByteBuffer>(bbs, false /* outputMode */);
{
- final byte r8 = (byte) bs.readUInt8(true /* msbFirst */);
+ final byte r8 = (byte) bs.readUInt8();
System.err.println("Read8.1 "+r8+", "+toHexBinaryString(r8, 8));
Assert.assertEquals(val8, r8);
}
// Test with written bitstream value
bs.setStream(bs.getSubStream(), true /* outputMode */);
- bs.writeInt8(true /* msbFirst */, val8);
+ bs.writeInt8(val8);
bs.setStream(bs.getSubStream(), false /* outputMode */); // switch to input-mode, implies flush()
{
- final byte r8 = (byte) bs.readUInt8(true /* msbFirst */);
+ final byte r8 = (byte) bs.readUInt8();
System.err.println("Read8.2 "+r8+", "+toHexBinaryString(r8, 8));
Assert.assertEquals(val8, r8);
}
@@ -114,12 +114,12 @@ public class TestBitstream02 extends SingletonJunitCase {
// Test with written bitstream value
final Bitstream.ByteBufferStream bbs = new Bitstream.ByteBufferStream(bb);
final Bitstream<ByteBuffer> bs = new Bitstream<ByteBuffer>(bbs, true /* outputMode */);
- bs.writeBits31(true /* msbFirst */, preBits, 0);
- bs.writeInt8(true /* msbFirst */, val8);
+ bs.writeBits31(preBits, 0);
+ bs.writeInt8(val8);
bs.setStream(bs.getSubStream(), false /* outputMode */); // switch to input-mode, implies flush()
- final int rPre = (short) bs.readBits31(true /* msbFirst */, preBits);
- final byte r8 = (byte) bs.readUInt8(true /* msbFirst */);
+ final int rPre = (short) bs.readBits31(preBits);
+ final byte r8 = (byte) bs.readUInt8();
System.err.println("ReadPre "+rPre+", "+toBinaryString(rPre, preBits));
System.err.println("Read8 "+r8+", "+toHexBinaryString(r8, 8));
Assert.assertEquals(val8, r8);