-
Notifications
You must be signed in to change notification settings - Fork 0
/
signalruntype_bitmask.go
72 lines (62 loc) · 1.92 KB
/
signalruntype_bitmask.go
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Code generated by "bitmasker -type SignalRunType"; DO NOT EDIT.
package enums
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the bitmasker command to generate them again.
var x [1]struct{}
_ = x[RUN_FIRST-1]
_ = x[RUN_LAST-2]
_ = x[RUN_BOTH-3]
_ = x[RUN_NO_RECURSE-8]
_ = x[RUN_ACTION-32]
_ = x[RUN_NO_HOOKS-64]
}
const (
_SignalRunType_name_0 = "RUN_FIRSTRUN_LASTRUN_BOTH"
_SignalRunType_name_1 = "RUN_NO_RECURSE"
_SignalRunType_name_2 = "RUN_ACTION"
_SignalRunType_name_3 = "RUN_NO_HOOKS"
)
var (
_SignalRunType_index_0 = [...]uint8{0, 9, 17, 25}
)
func (i SignalRunType) String() (value string) {
update := func(t SignalRunType, n string) {
if i.Has(t) {
if len(value) > 0 {
value += " | "
}
value += n
}
}
update(SignalRunType(1), _SignalRunType_name_0[_SignalRunType_index_0[0]:_SignalRunType_index_0[0+1]])
update(SignalRunType(2), _SignalRunType_name_0[_SignalRunType_index_0[1]:_SignalRunType_index_0[1+1]])
update(SignalRunType(3), _SignalRunType_name_0[_SignalRunType_index_0[2]:_SignalRunType_index_0[2+1]])
update(SignalRunType(8), _SignalRunType_name_1)
update(SignalRunType(32), _SignalRunType_name_2)
update(SignalRunType(64), _SignalRunType_name_3)
if value == "" {
return "SignalRunType(" + strconv.FormatInt(int64(i), 10) + ")"
}
return
}
// Has returns TRUE if the given flag is present in the bitmask
func (i SignalRunType) Has(m SignalRunType) bool {
if i == m {
return true
}
return i&m != 0
}
// Set returns the bitmask with the given flag set
func (i SignalRunType) Set(m SignalRunType) SignalRunType {
return i | m
}
// Clear returns the bitmask with the given flag removed
func (i SignalRunType) Clear(m SignalRunType) SignalRunType {
return i &^ m
}
// Toggle returns the bitmask with the given flag toggled
func (i SignalRunType) Toggle(m SignalRunType) SignalRunType {
return i ^ m
}