added flags operations

This commit is contained in:
2024-11-26 06:02:12 +02:00
parent 2d725be6a5
commit e9268f0c1f
2 changed files with 26 additions and 0 deletions

14
bin.go
View File

@@ -1536,3 +1536,17 @@ func Uint64AsInt64(u uint64) int64 {
i, _ := GetInt64(arr, LH)
return i
}
// FLAGS
func IsSetFlag(flags byte, flag byte) bool {
return (flags & flag) == flag
}
func SetFlag(flags byte, flag byte) byte {
return flags | flag
}
func UnsetFlag(flags byte, flag byte) byte {
return flags & ^flag
}