func HasAny32(bits int32, flags ...int) bool {
	return HasAnyMask32(bits, Mask32(flags...))
}
HasAny32 checks if *any* of a set of flags are set for ordinal bit position flags (logical OR)
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...))
}
func Has(bits int64, flag int) bool {
	return bits&(1<<uint32(flag)) != 0
}
func HasAtomic(bits *int64, flag int) bool {
	return atomic.LoadInt64(bits)&(1<<uint32(flag)) != 0
}
func HasAny(bits int64, flags ...int) bool {
	return HasAnyMask(bits, Mask(flags...))
}
func HasAll(bits int64, flags ...int) bool {
	return HasAllMask(bits, Mask(flags...))
}
func HasAnyAtomic(bits *int64, flags ...int) bool {
	return HasAnyMaskAtomic(bits, Mask(flags...))
}
func HasAllAtomic(bits *int64, flags ...int) bool {
	return HasAllMaskAtomic(bits, Mask(flags...))
}
func Toggle(bits *int64, flags ...int) {
	for _, f := range flags {
		if Has(*bits, f) {
			Clear(bits, f)
		} else {
			Set(bits, f)
		}
	}
}
func ToggleAtomic(bits *int64, flags ...int) {
	for _, f := range flags {
		if HasAtomic(bits, f) {
			ClearAtomic(bits, f)
		} else {
			SetAtomic(bits, f)
		}
	}
}
func SetMask32(bits *int32, mask int32) {
	*bits |= mask
}
func SetMaskAtomic32(bits *int32, mask int32) {
	for {
		cr := atomic.LoadInt32(bits)
		nw := cr | mask
		if atomic.CompareAndSwapInt32(bits, cr, nw) {
			break
		}
	}
}
func ClearMask32(bits *int32, mask int32) {
	*bits &^= mask
}
func ClearMaskAtomic32(bits *int32, mask int32) {
	for {
		cr := atomic.LoadInt32(bits)
		nw := cr &^ mask
		if atomic.CompareAndSwapInt32(bits, cr, nw) {
			break
		}
	}
}
func HasAnyMask32(bits, mask int32) bool {
	return bits&mask != 0
}
func HasAllMask32(bits, mask int32) bool {
	return bits&mask == mask
}
func HasAnyMaskAtomic32(bits *int32, mask int32) bool {
	return (atomic.LoadInt32(bits) & mask) != 0
}
func HasAllMaskAtomic32(bits *int32, mask int32) bool {
	return (atomic.LoadInt32(bits) & mask) == mask
}
func Mask32(flags ...int) int32 {
	var mask int32
	for _, f := range flags {
		mask |= 1 << uint32(f)
	}
	return mask
}
func Set32(bits *int32, flags ...int) {
	SetMask32(bits, Mask32(flags...))
}
func SetAtomic32(bits *int32, flags ...int) {
	SetMaskAtomic32(bits, Mask32(flags...))
}
func SetState32(bits *int32, state bool, flags ...int) {
	if state {
		Set32(bits, flags...)
	} else {
		Clear32(bits, flags...)
	}
}
func SetStateAtomic32(bits *int32, state bool, flags ...int) {
	if state {
		SetAtomic32(bits, flags...)
	} else {
		ClearAtomic32(bits, flags...)
	}
}
func Clear32(bits *int32, flags ...int) {
	ClearMask32(bits, Mask32(flags...))
}
func ClearAtomic32(bits *int32, flags ...int) {
	ClearMaskAtomic32(bits, Mask32(flags...))
}
func Has32(bits int32, flag int) bool {
	return bits&(1<<uint32(flag)) != 0
}
func HasAtomic32(bits *int32, flag int) bool {
	return atomic.LoadInt32(bits)&(1<<uint32(flag)) != 0
}