File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
src/main/java/com/jagex/runescape/cache/def Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 7
7
import com .jagex .runescape .util .BitUtils ;
8
8
9
9
public class VarbitDefinition extends CachedNode {
10
- public static int [] varbitMasks = new int [32 ];
11
10
public static NodeCache varbitDefinitionCache = new NodeCache (64 );
12
11
public static CacheArchive gameDefinitionsCacheArchive ;
13
12
14
- // Pre-calculate varbit masks
13
+ /**
14
+ * Contains information on the bit mask to use per specified bits.
15
+ * Example:
16
+ * We want to have a mask of 6 bits, which would look like this: 00111111 (decimal: 63)
17
+ * Since this array starts from index 0, the 6th index is varbitMasks[5].
18
+ * So varbitMasks[5] == 63 == 00111111
19
+ * The mask can then be used together with "varPlayerValue >> LSB" to find the actual varbit value.
20
+ */
21
+ public static int [] varbitMasks = new int [32 ];
15
22
static {
16
- int i = 2 ;
17
- for (int i_7_ = 0 ; i_7_ < 32 ; i_7_ ++) {
18
- varbitMasks [i_7_ ] = - 1 + i ;
19
- i += i ;
23
+ int currentBit = 2 ;
24
+ for (int index = 0 ; index < 32 ; index ++) {
25
+ varbitMasks [index ] = currentBit - 1 ;
26
+ currentBit += currentBit ;
20
27
}
21
28
}
22
29
You can’t perform that action at this time.
0 commit comments