Long2IntQuick.java
915 Bytes
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
package is2.data;
/**
* @author Bernd Bohnet, 01.09.2009
*
* Maps for the Hash Kernel the long values to the int values.
*/
final public class Long2IntQuick implements Long2IntInterface {
/** Integer counter for long2int */
final private int size;
public Long2IntQuick() {
size=0x07ffffff;
}
public Long2IntQuick(int s) {
size=s;
}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#size()
*/
public int size() {return size;}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#start()
* has no meaning for this implementation
*/
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#l2i(long)
*/
final public int l2i(long r) {
long l = (r>>16)&0xfffffffffffff000L;
r ^= l;
r ^= l = (l>>12)&0xffffffffffff0000L;
r ^= l = (l>>8)& 0xfffffffffffc0000L;
return (int)(r % size);
}
}