Skip to content

Commit

Permalink
add bit flags for future use
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintWish committed Sep 28, 2024
1 parent b1957ba commit 52b5475
Show file tree
Hide file tree
Showing 10 changed files with 1,089 additions and 945 deletions.
29 changes: 29 additions & 0 deletions internal/bitmask/bitmask.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package bitmask

import (

)

type Bitmask uint32

const (
BANNED Bitmask = 1 << iota
DONOR
ADMIN
)

func (f Bitmask) HasFlag(flag Bitmask) bool {
return f&flag != 0
}

func (f *Bitmask) AddFlag(flag Bitmask) {
*f |= flag
}

func (f *Bitmask) ClearFlag(flag Bitmask) {
*f &= ^flag
}

func (f *Bitmask) ToggleFlag(flag Bitmask) {
*f ^= flag
}
Loading

0 comments on commit 52b5475

Please sign in to comment.