-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddressingModel.java
56 lines (50 loc) · 1.85 KB
/
AddressingModel.java
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
package com.destranix.glslang;
public enum AddressingModel {
AddressingModelLogical(Main.ADDRESSING_MODEL_LOGICAL),
AddressingModelPhysical32(Main.ADDRESSING_MODEL_PHYSICAL_32),
AddressingModelPhysical64(Main.ADDRESSING_MODEL_PHYSICAL_64),
AddressingModelPhysicalStorageBuffer64(Main.ADDRESSING_MODEL_PHYSICAL_STORAGE_BUFFER_64),
AddressingModelPhysicalStorageBuffer64EXT(Main.ADDRESSING_MODEL_PHYSICAL_STORAGE_BUFFER_64_EXT),
AddressingModelMax(Main.ADDRESSING_MODEL_MAX);
private final int value;
private AddressingModel(int value) {
this.value = value;
}
public int getConstant() {
return this.value;
}
public static AddressingModel valueByStr(String str) {
switch (str) {
case "AddressingModelLogical":
return AddressingModelLogical;
case "AddressingModelPhysical32":
return AddressingModelPhysical32;
case "AddressingModelPhysical64":
return AddressingModelPhysical64;
case "AddressingModelPhysicalStorageBuffer64":
return AddressingModelPhysicalStorageBuffer64;
case "AddressingModelPhysicalStorageBuffer64EXT":
return AddressingModelPhysicalStorageBuffer64EXT;
case "AddressingModelMax":
return AddressingModelMax;
default:
throw new IllegalArgumentException("Cannot translate string into enum value!");
}
}
public static AddressingModel valueByConstant(int constant) {
switch (constant) {
case Main.ADDRESSING_MODEL_LOGICAL:
return AddressingModelLogical;
case Main.ADDRESSING_MODEL_PHYSICAL_32:
return AddressingModelPhysical32;
case Main.ADDRESSING_MODEL_PHYSICAL_64:
return AddressingModelPhysical64;
case Main.ADDRESSING_MODEL_PHYSICAL_STORAGE_BUFFER_64:
return AddressingModelPhysicalStorageBuffer64;
case Main.ADDRESSING_MODEL_MAX:
return AddressingModelMax;
default:
throw new IllegalArgumentException("Cannot translate constant into enum value!");
}
}
}