allg5/flagmut.go

24 lines
329 B
Go
Raw Normal View History

2019-12-19 06:08:52 +00:00
package allg5
// #include <stdlib.h>
import "C"
type FlagMutation interface {
Set(f NewBitmapFlag)
Unset(f NewBitmapFlag)
}
type flagMut struct {
flg C.int
}
func (m *flagMut) Set(f NewBitmapFlag) {
m.flg |= C.int(f)
}
func (m *flagMut) Unset(f NewBitmapFlag) {
if m.flg&C.int(f) == C.int(f) {
m.flg ^= C.int(f)
}
}