Skip to content

Commit 26a1805

Browse files
committed
2 parents d74e397 + babc646 commit 26a1805

File tree

5 files changed

+64
-31
lines changed

5 files changed

+64
-31
lines changed

README.md

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -104,53 +104,62 @@ non-vectorized implementation. For an example usage, see
104104
examples/vector/Example.java. The feature requires JDK 19+ and is currently for
105105
advanced users.
106106

107-
JavaFastPFOR as a dependency (JitPack)
107+
JavaFastPFOR as a dependency
108108
------------------------
109109

110+
JavaFastPFOR is available both on Maven Central and JitPack, so you can easily
111+
include it in your project using either source.
112+
110113
We have a demo project using JavaFastPFOR as a dependency (both Maven and Gradle). See...
111114

112115
https://github.com/fast-pack/JavaFastPFORDemo
113116

114-
1. **Maven**
117+
### Maven Central
118+
119+
You can add JavaFastPFOR directly from Maven Central — no extra repository configuration needed:
115120

116-
Using this code in your own project is easy with maven, just add
117-
the following code in your pom.xml file:
121+
**Maven**
118122

119123
```xml
120-
<dependency>
121-
<groupId>com.github.fast-pack</groupId>
122-
<artifactId>JavaFastPFor</artifactId>
123-
<version>JavaFastPFOR-0.3.2</version>
124-
</dependency>
124+
<dependency>
125+
<groupId>me.lemire.integercompression</groupId>
126+
<artifactId>JavaFastPFOR</artifactId>
127+
<version>0.3.8</version>
128+
</dependency>
125129
```
126130

127-
as well as jitpack as a repository...
131+
**Gradle (Groovy)**
128132

129-
```xml
130-
<repositories>
131-
<repository>
132-
<id>jitpack.io</id>
133-
<url>https://jitpack.io</url>
134-
</repository>
135-
</repositories>
133+
```groovy
134+
dependencies {
135+
implementation 'me.lemire.integercompression:JavaFastPFOR:0.3.8'
136+
}
136137
```
137138

138-
Naturally, you should replace "version" by the version
139-
you desire.
139+
### JitPack
140140

141+
If you prefer or need to use JitPack, you can include the dependency like this:
141142

142-
2. **Gradle (groovy)**
143+
**Maven**
143144

145+
```xml
146+
<repositories>
147+
<repository>
148+
<id>jitpack.io</id>
149+
<url>https://jitpack.io</url>
150+
</repository>
151+
</repositories>
152+
153+
<dependency>
154+
<groupId>com.github.fast-pack</groupId>
155+
<artifactId>JavaFastPFOR</artifactId>
156+
<version>JavaFastPFOR-0.3.8</version>
157+
</dependency>
158+
```
144159

145-
Then all you need is to edit your `build.gradle` file like so:
146-
160+
**Gradle (groovy)**
147161

148162
```groovy
149-
plugins {
150-
id 'java'
151-
}
152-
153-
154163
repositories {
155164
mavenCentral()
156165
maven {
@@ -159,11 +168,10 @@ repositories {
159168
}
160169
161170
dependencies {
162-
implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.2'
171+
implementation 'com.github.fast-pack:JavaFastPFOR:JavaFastPFOR-0.3.8'
163172
}
164173
```
165174

166-
167175
Naturally, you should replace "version" by the version
168176
you desire.
169177

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>me.lemire.integercompression</groupId>
44
<artifactId>JavaFastPFOR</artifactId>
5-
<version>0.3.9-SNAPSHOT</version>
5+
<version>0.3.11-SNAPSHOT</version>
66
<packaging>jar</packaging>
77
<properties>
88
<maven.compiler.source>21</maven.compiler.source>

src/main/java/me/lemire/longcompression/differential/LongDelta.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static void fastinverseDelta(long[] data) {
107107
}
108108
}
109109

110-
for (; i != data.length; ++i) {
110+
for (; i < data.length; ++i) {
111111
data[i] += data[i - 1];
112112
}
113113
}

src/main/java/module-info.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
// requires jdk.incubator.vector;
77
exports me.lemire.integercompression;
88
exports me.lemire.longcompression;
9+
exports me.lemire.longcompression.differential;
10+
exports me.lemire.integercompression.differential;
911
// exports me.lemire.integercompression.vector;
1012
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package me.lemire.longcompression;
2+
3+
import me.lemire.longcompression.differential.LongDelta;
4+
import org.junit.Test;
5+
6+
import static org.junit.Assert.assertArrayEquals;
7+
import static org.junit.Assert.assertNotNull;
8+
9+
public class LongDeltaTest {
10+
@Test
11+
public void testEmptyArrayFastInverseDelta() {
12+
LongCompressor compressor = new LongCompressor();
13+
long[] input = new long[0];
14+
15+
LongDelta.delta(input);
16+
long[] compressed = compressor.compress(input);
17+
long[] result = compressor.uncompress(compressed);
18+
LongDelta.fastinverseDelta(result);
19+
20+
assertNotNull(result);
21+
assertArrayEquals(input, result);
22+
}
23+
}

0 commit comments

Comments
 (0)