burmanm / compression-int

64-bit integer compression algorithms in Java
Apache License 2.0
15 stars 3 forks source link

Simple8 RLE wrong decompression #6

Open kba-3e opened 5 years ago

kba-3e commented 5 years ago

The Simple8 RLE decompression gives wrong values, for some inputs. In particular, when expanding a RLE compressed value, with significand bit set to 1, it will return a negative value. For example: {0xF0000000L, 0xF0000000L, 0xF0000000L}

The offending line is https://github.com/burmanm/compression-int/blob/cb30ac0670cf43d094b8bb9961f2ec7ad19e130f/src/main/java/fi/iki/yak/compression/integer/Simple8RLE.java#L312

Which should be:

          long value = input[inputPos] & 0xFFFFFFFFL; // Last 32 bits only