forked from fast-pack/JavaFastPFOR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustCopy.java
More file actions
57 lines (46 loc) · 1.64 KB
/
JustCopy.java
File metadata and controls
57 lines (46 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* This code is released under the
* Apache License Version 2.0 http://www.apache.org/licenses/.
*
* (c) Daniel Lemire, http://lemire.me/en/
*/
package me.lemire.integercompression;
/**
* @author Daniel Lemire
*
*/
public final class JustCopy implements IntegerCODEC, SkippableIntegerCODEC {
@Override
public void headlessCompress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
System.arraycopy(in, inpos.get(), out, outpos.get(), inlength);
inpos.add(inlength);
outpos.add(inlength);
}
@Override
public void uncompress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
headlessUncompress(in,inpos,inlength,out,outpos,inlength);
}
@Override
public String toString() {
return this.getClass().getSimpleName();
}
@Override
public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos, int num) {
System.arraycopy(in, inpos.get(), out, outpos.get(), num);
inpos.add(num);
outpos.add(num);
}
@Override
public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
compressedPositions.add(inlength);
return inlength;
}
@Override
public void compress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
headlessCompress(in,inpos,inlength,out,outpos);
}
}