-
Notifications
You must be signed in to change notification settings - Fork 0
/
FPRoundingMode.java
53 lines (47 loc) · 1.39 KB
/
FPRoundingMode.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
package com.destranix.glslang;
public enum FPRoundingMode {
FPRoundingModeRTE(Main.FP_ROUNDING_MODE_RTE),
FPRoundingModeRTZ(Main.FP_ROUNDING_MODE_RTZ),
FPRoundingModeRTP(Main.FP_ROUNDING_MODE_RTP),
FPRoundingModeRTN(Main.FP_ROUNDING_MODE_RTN),
FPRoundingModeMax(Main.FP_ROUNDING_MODE_MAX);
private final int value;
private FPRoundingMode(int value) {
this.value = value;
}
public int getConstant() {
return this.value;
}
public static FPRoundingMode valueByStr(String str) {
switch (str) {
case "FPRoundingModeRTE":
return FPRoundingModeRTE;
case "FPRoundingModeRTZ":
return FPRoundingModeRTZ;
case "FPRoundingModeRTP":
return FPRoundingModeRTP;
case "FPRoundingModeRTN":
return FPRoundingModeRTN;
case "FPRoundingModeMax":
return FPRoundingModeMax;
default:
throw new IllegalArgumentException("Cannot translate string into enum value!");
}
}
public static FPRoundingMode valueByConstant(int constant) {
switch (constant) {
case Main.FP_ROUNDING_MODE_RTE:
return FPRoundingModeRTE;
case Main.FP_ROUNDING_MODE_RTZ:
return FPRoundingModeRTZ;
case Main.FP_ROUNDING_MODE_RTP:
return FPRoundingModeRTP;
case Main.FP_ROUNDING_MODE_RTN:
return FPRoundingModeRTN;
case Main.FP_ROUNDING_MODE_MAX:
return FPRoundingModeMax;
default:
throw new IllegalArgumentException("Cannot translate constant into enum value!");
}
}
}