MCPcopy Create free account
hub / github.com/Hiro420/NikkeTools / Field

Class Field

UnLuac/src/unluac/decompile/CodeExtract.java:7–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5public class CodeExtract {
6
7public static class Field {
8
9 public Field(int size, int shift) {
10 this(size, shift, 0);
11 }
12
13 public Field(int size, int shift, int offset) {
14 this.size = size;
15 this.shift = shift;
16 this.mask = size_to_mask(size);
17 this.offset = offset;
18 }
19
20 public int extract(int codepoint) {
21 return ((codepoint >>> shift) & mask) - offset;
22 }
23
24 public boolean check(int x) {
25 return ((x + offset) & ~mask) == 0;
26 }
27
28 public int encode(int x) {
29 return (x + offset) << shift;
30 }
31
32 public int clear(int codepoint) {
33 return codepoint & ~(mask << shift);
34 }
35
36 public int max() {
37 return mask - offset;
38 }
39
40 public final int size;
41 private final int shift;
42 private final int mask;
43 private final int offset;
44
45 }
46
47 public CodeExtract(Version version, int sizeOp, int sizeA, int sizeB, int sizeC) {
48 switch(version.instructionformat.get()) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected