New upstream version 1.1.4
Emmanuel Bourg
3 years ago
0 | version 1.1.4 (December 17th 2015) | |
1 | - Fixed issue 60: bitmap shift then or | |
2 | ||
0 | 3 | version 1.1.3 (December 3rd 2015) |
1 | - Fixed issue 59 | |
4 | - Fixed issue 59: ChunkIterator not iterating correctly | |
2 | 5 | |
3 | 6 | version 1.1.2 (November 11th 2015) |
4 | 7 | - Fixed issue 58: ChunkIterator not iterating correctly? |
1 | 1 | <modelVersion>4.0.0</modelVersion> |
2 | 2 | <groupId>com.googlecode.javaewah</groupId> |
3 | 3 | <artifactId>JavaEWAH</artifactId> |
4 | <version>1.1.3</version> | |
4 | <version>1.1.4</version> | |
5 | 5 | <packaging>bundle</packaging> |
6 | 6 | <properties> |
7 | 7 | <maven.compiler.source>1.6</maven.compiler.source> |
2082 | 2082 | } |
2083 | 2083 | } |
2084 | 2084 | } else { |
2085 | // whether the shift should justify a new word | |
2086 | final boolean shiftextension = ((this.sizeInBits + WORD_IN_BITS - 1) % WORD_IN_BITS) + shift >= WORD_IN_BITS; | |
2085 | 2087 | long w = 0; |
2086 | 2088 | while (true) { |
2087 | 2089 | long rl = i.getRunningLength(); |
2106 | 2108 | w = neww >>> (WORD_IN_BITS - shift); |
2107 | 2109 | } |
2108 | 2110 | if (!i.next()) { |
2109 | answer.addWord(w); | |
2111 | if(shiftextension) answer.addWord(w); | |
2110 | 2112 | break; |
2111 | 2113 | } |
2112 | 2114 | } |
2091 | 2091 | int w = 0; |
2092 | 2092 | while (true) { |
2093 | 2093 | int rl = i.getRunningLength(); |
2094 | // whether the shift should justify a new word | |
2095 | final boolean shiftextension = ((this.sizeInBits + WORD_IN_BITS - 1) % WORD_IN_BITS) + shift >= WORD_IN_BITS; | |
2094 | 2096 | if (rl > 0) { |
2095 | 2097 | if (i.getRunningBit()) { |
2096 | 2098 | int sw = w | (-1 << shift); |
2112 | 2114 | w = neww >>> (WORD_IN_BITS - shift); |
2113 | 2115 | } |
2114 | 2116 | if (!i.next()) { |
2115 | answer.addWord(w); | |
2117 | if(shiftextension) answer.addWord(w); | |
2116 | 2118 | break; |
2117 | 2119 | } |
2118 | 2120 | } |
20 | 20 | */ |
21 | 21 | @SuppressWarnings("javadoc") |
22 | 22 | public class EWAHCompressedBitmapTest { |
23 | ||
23 | ||
24 | @Test | |
25 | public void shiftbug001() { | |
26 | EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(10, 11, 12, 13); | |
27 | EWAHCompressedBitmap bm2 = bm1.shift(1); | |
28 | ||
29 | EWAHCompressedBitmap bm3 = bm1.or(bm2); | |
30 | EWAHCompressedBitmap bm4 = EWAHCompressedBitmap.bitmapOf(10,11,12,13,14); | |
31 | Assert.assertEquals(bm3, bm4); | |
32 | } | |
33 | ||
34 | @Test | |
35 | public void shiftbug002() { | |
36 | EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(10, 11, 12, 13, 63); | |
37 | EWAHCompressedBitmap bm2 = bm1.shift(1); | |
38 | ||
39 | EWAHCompressedBitmap bm3 = bm1.or(bm2); | |
40 | EWAHCompressedBitmap bm4 = EWAHCompressedBitmap.bitmapOf(10,11,12,13,14, 63, 64); | |
41 | Assert.assertEquals(bm3, bm4); | |
42 | } | |
43 | ||
44 | @Test | |
45 | public void shiftbug003() { | |
46 | EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(10, 11, 12, 13, 62); | |
47 | EWAHCompressedBitmap bm2 = bm1.shift(1); | |
48 | ||
49 | EWAHCompressedBitmap bm3 = bm1.or(bm2); | |
50 | EWAHCompressedBitmap bm4 = EWAHCompressedBitmap.bitmapOf(10,11,12,13,14, 62, 63); | |
51 | Assert.assertEquals(bm3, bm4); | |
52 | } | |
53 | ||
54 | @Test | |
55 | public void shiftbug004() { | |
56 | EWAHCompressedBitmap bm1 = EWAHCompressedBitmap.bitmapOf(10, 11, 12, 13, 64); | |
57 | EWAHCompressedBitmap bm2 = bm1.shift(1); | |
58 | ||
59 | EWAHCompressedBitmap bm3 = bm1.or(bm2); | |
60 | EWAHCompressedBitmap bm4 = EWAHCompressedBitmap.bitmapOf(10,11,12,13,14, 64, 65); | |
61 | Assert.assertEquals(bm3, bm4); | |
62 | } | |
63 | ||
64 | ||
24 | 65 | @Test |
25 | 66 | public void example() throws Exception { |
26 | 67 | EWAHCompressedBitmap ewahBitmap1 = EWAHCompressedBitmap.bitmapOf(0, 2, 55, 64, 1 << 30); |
23 | 23 | @SuppressWarnings("javadoc") |
24 | 24 | public class EWAHCompressedBitmap32Test { |
25 | 25 | |
26 | ||
27 | @Test | |
28 | public void shiftbug001() { | |
29 | EWAHCompressedBitmap32 bm1 = EWAHCompressedBitmap32.bitmapOf(10, 11, 12, 13); | |
30 | EWAHCompressedBitmap32 bm2 = bm1.shift(1); | |
31 | ||
32 | EWAHCompressedBitmap32 bm3 = bm1.or(bm2); | |
33 | EWAHCompressedBitmap32 bm4 = EWAHCompressedBitmap32.bitmapOf(10,11,12,13,14); | |
34 | Assert.assertEquals(bm3, bm4); | |
35 | } | |
36 | ||
37 | ||
38 | @Test | |
39 | public void shiftbug002() { | |
40 | EWAHCompressedBitmap32 bm1 = EWAHCompressedBitmap32.bitmapOf(10, 11, 12, 13, 31); | |
41 | EWAHCompressedBitmap32 bm2 = bm1.shift(1); | |
42 | ||
43 | EWAHCompressedBitmap32 bm3 = bm1.or(bm2); | |
44 | EWAHCompressedBitmap32 bm4 = EWAHCompressedBitmap32.bitmapOf(10,11,12,13,14, 31, 32); | |
45 | Assert.assertEquals(bm3, bm4); | |
46 | } | |
47 | ||
48 | ||
49 | @Test | |
50 | public void shiftbug003() { | |
51 | EWAHCompressedBitmap32 bm1 = EWAHCompressedBitmap32.bitmapOf(10, 11, 12, 13, 30); | |
52 | EWAHCompressedBitmap32 bm2 = bm1.shift(1); | |
53 | ||
54 | EWAHCompressedBitmap32 bm3 = bm1.or(bm2); | |
55 | EWAHCompressedBitmap32 bm4 = EWAHCompressedBitmap32.bitmapOf(10,11,12,13,14, 30, 31); | |
56 | Assert.assertEquals(bm3, bm4); | |
57 | } | |
58 | ||
59 | @Test | |
60 | public void shiftbug004() { | |
61 | EWAHCompressedBitmap32 bm1 = EWAHCompressedBitmap32.bitmapOf(10, 11, 12, 13, 32); | |
62 | EWAHCompressedBitmap32 bm2 = bm1.shift(1); | |
63 | ||
64 | EWAHCompressedBitmap32 bm3 = bm1.or(bm2); | |
65 | EWAHCompressedBitmap32 bm4 = EWAHCompressedBitmap32.bitmapOf(10,11,12,13,14, 32, 33); | |
66 | Assert.assertEquals(bm3, bm4); | |
67 | } | |
68 | ||
69 | ||
26 | 70 | @Test |
27 | 71 | public void issue54() { |
28 | 72 | EWAHCompressedBitmap32 bm = new EWAHCompressedBitmap32(); |