func Has(bits int64, flag int) bool {
	return bits&(1<<uint32(flag)) != 0
}
Has checks if given bit value is set for ordinal bit position flag
package bitflag
import "sync/atomic"
func SetMask(bits *int64, mask int64) {
	*bits |= mask
}
func SetMaskAtomic(bits *int64, mask int64) {
	for {
		cr := atomic.LoadInt64(bits)
		nw := cr | mask
		if atomic.CompareAndSwapInt64(bits, cr, nw) {
			break
		}
	}
}
func ClearMask(bits *int64, mask int64) {
	*bits &^= mask
}
func ClearMaskAtomic(bits *int64, mask int64) {
	for {
		cr := atomic.LoadInt64(bits)
		nw := cr &^ mask
		if atomic.CompareAndSwapInt64(bits, cr, nw) {
			break
		}
	}
}
func HasAnyMask(bits, mask int64) bool {
	return bits&mask != 0
}
func HasAllMask(bits, mask int64) bool {
	return bits&mask == mask
}
func HasAnyMaskAtomic(bits *int64, mask int64) bool {
	return (atomic.LoadInt64(bits) & mask) != 0
}
func HasAllMaskAtomic(bits *int64, mask int64) bool {
	return (atomic.LoadInt64(bits) & mask) == mask
}
func Mask(flags ...int) int64 {
	var mask int64
	for _, f := range flags {
		mask |= 1 << uint32(f)
	}
	return mask
}
func Set(bits *int64, flags ...int) {
	SetMask(bits, Mask(flags...))
}
func SetAtomic(bits *int64, flags ...int) {
	SetMaskAtomic(bits, Mask(flags...))
}
func SetState(bits *int64, state bool, flags ...int) {
	if state {
		Set(bits, flags...)
	} else {
		Clear(bits, flags...)
	}
}
func SetStateAtomic(bits *int64, state bool, flags ...int) {
	if state {
		SetAtomic(bits, flags...)
	} else {
		ClearAtomic(bits, flags...)
	}
}
func Clear(bits *int64, flags ...int) {
	ClearMask(bits, Mask(flags...))
}
func ClearAtomic(bits *int64, flags ...int) {
	ClearMaskAtomic(bits, Mask(flags...))
}