bitflag

package
v1.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: BSD-3-Clause Imports: 1 Imported by: 22

README

bitflag

Go Report Card GoDoc

Package bitflag provides simple bit flag setting, checking, and clearing methods that take bit position args as ints (from const int eunum iota's) and do the bit shifting from there -- although a tiny bit slower, the convenience of maintaining ordinal lists of bit positions greatly outweighs that cost -- see kit type registry for further enum management functions

Documentation

Overview

Package bitflag provides simple bit flag setting, checking, and clearing methods that take bit position args as ints (from const int eunum iota's) and do the bit shifting from there -- although a tiny bit slower, the convenience of maintaining ordinal lists of bit positions greatly outweighs that cost -- see kit type registry for further enum management functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(bits *int64, flags ...int)

Clear clears bit value(s) for ordinal bit position flags

func Clear32

func Clear32(bits *int32, flags ...int)

Clear32 clears bit value(s) for ordinal bit position flags

func ClearAtomic

func ClearAtomic(bits *int64, flags ...int)

ClearAtomic clears bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access

func ClearAtomic32

func ClearAtomic32(bits *int32, flags ...int)

ClearAtomic32 clears bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access

func ClearMask

func ClearMask(bits *int64, mask int64)

ClearMask clears all of the bits in the mask

func ClearMask32

func ClearMask32(bits *int32, mask int32)

ClearMask32 clears all of the bits in the mask

func ClearMaskAtomic

func ClearMaskAtomic(bits *int64, mask int64)

ClearMaskAtomic clears all of the bits in the mask using atomic compare-and-swap loop, safe for concurrent access

func ClearMaskAtomic32

func ClearMaskAtomic32(bits *int32, mask int32)

ClearMaskAtomic32 clears all of the bits in the mask using atomic compare-and-swap loop, safe for concurrent access

func Has

func Has(bits int64, flag int) bool

Has checks if given bit value is set for ordinal bit position flag

func Has32

func Has32(bits int32, flag int) bool

Has32 checks if given bit value is set for ordinal bit position flag

func HasAll

func HasAll(bits int64, flags ...int) bool

HasAll checks if *all* of a set of flags are set for ordinal bit position flags (logical AND)

func HasAll32

func HasAll32(bits int32, flags ...int) bool

HasAll32 checks if *all* of a set of flags are set for ordinal bit position flags (logical AND)

func HasAllAtomic

func HasAllAtomic(bits *int64, flags ...int) bool

HasAllAtomic checks if *all* of a set of flags are set for ordinal bit position flags (logical AND) using atomic compare-and-swap loop, safe for concurrent access

func HasAllAtomic32

func HasAllAtomic32(bits *int32, flags ...int) bool

HasAllAtomic32 checks if *all* of a set of flags are set for ordinal bit position flags (logical AND) using atomic compare-and-swap loop, safe for concurrent access

func HasAllMask

func HasAllMask(bits, mask int64) bool

HasAllMask checks if *all* of the bits in mask are set (logical AND)

func HasAllMask32

func HasAllMask32(bits, mask int32) bool

HasAllMask32 checks if *all* of the bits in mask are set (logical AND)

func HasAllMaskAtomic

func HasAllMaskAtomic(bits *int64, mask int64) bool

HasAllMaskAtomic checks if *all* of the bits in mask are set (logical AND) using atomic compare-and-swap loop, safe for concurrent access

func HasAllMaskAtomic32

func HasAllMaskAtomic32(bits *int32, mask int32) bool

HasAllMaskAtomic32 checks if *all* of the bits in mask are set (logical AND) using atomic compare-and-swap loop, safe for concurrent access

func HasAny

func HasAny(bits int64, flags ...int) bool

HasAny checks if *any* of a set of flags are set for ordinal bit position flags (logical OR)

func HasAny32

func HasAny32(bits int32, flags ...int) bool

HasAny32 checks if *any* of a set of flags are set for ordinal bit position flags (logical OR)

func HasAnyAtomic

func HasAnyAtomic(bits *int64, flags ...int) bool

HasAnyAtomic checks if *any* of a set of flags are set for ordinal bit position flags (logical OR) using atomic compare-and-swap loop, safe for concurrent access

func HasAnyAtomic32

func HasAnyAtomic32(bits *int32, flags ...int) bool

HasAnyAtomic32 checks if *any* of a set of flags are set for ordinal bit position flags (logical OR) using atomic compare-and-swap loop, safe for concurrent access

func HasAnyMask

func HasAnyMask(bits, mask int64) bool

HasAnyMask checks if *any* of the bits in mask are set (logical OR)

func HasAnyMask32

func HasAnyMask32(bits, mask int32) bool

HasAnyMask32 checks if *any* of the bits in mask are set (logical OR)

func HasAnyMaskAtomic

func HasAnyMaskAtomic(bits *int64, mask int64) bool

HasAnyMaskAtomic checks if *any* of the bits in mask are set (logical OR) using atomic compare-and-swap loop, safe for concurrent access

func HasAnyMaskAtomic32

func HasAnyMaskAtomic32(bits *int32, mask int32) bool

HasAnyMaskAtomic32 checks if *any* of the bits in mask are set (logical OR) using atomic compare-and-swap loop, safe for concurrent access

func HasAtomic

func HasAtomic(bits *int64, flag int) bool

HasAtomic checks if given bit value is set for ordinal bit position flag, using an atomic load, safe for concurrent access

func HasAtomic32

func HasAtomic32(bits *int32, flag int) bool

HasAtomic32 checks if given bit value is set for ordinal bit position flag, using an atomic load, safe for concurrent access

func Mask

func Mask(flags ...int) int64

Mask makes a mask for checking multiple different flags

func Mask32

func Mask32(flags ...int) int32

Mask32 makes a mask for checking multiple different flags

func Set

func Set(bits *int64, flags ...int)

Set sets bit value(s) for ordinal bit position flags

func Set32

func Set32(bits *int32, flags ...int)

Set32 sets bit value(s) for ordinal bit position flags

func SetAtomic

func SetAtomic(bits *int64, flags ...int)

SetAtomic sets bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access

func SetAtomic32

func SetAtomic32(bits *int32, flags ...int)

SetAtomic32 sets bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access

func SetMask

func SetMask(bits *int64, mask int64)

SetMask sets bits in mask

func SetMask32

func SetMask32(bits *int32, mask int32)

SetMask32 sets bits in mask

func SetMaskAtomic

func SetMaskAtomic(bits *int64, mask int64)

SetMaskAtomic sets bits in mask using atomic compare-and-swap loop, safe for concurrent access

func SetMaskAtomic32

func SetMaskAtomic32(bits *int32, mask int32)

SetMaskAtomic32 sets bits in mask using atomic compare-and-swap loop, safe for concurrent access

func SetState

func SetState(bits *int64, state bool, flags ...int)

SetState sets or clears bit value(s) depending on state (on / off) for ordinal bit position flags

func SetState32

func SetState32(bits *int32, state bool, flags ...int)

SetState32 sets or clears bit value(s) depending on state (on / off) for ordinal bit position flags

func SetStateAtomic

func SetStateAtomic(bits *int64, state bool, flags ...int)

SetStateAtomic sets or clears bit value(s) depending on state (on / off) for ordinal bit position flags, protected by atomic -- safe for concurrent access

func SetStateAtomic32

func SetStateAtomic32(bits *int32, state bool, flags ...int)

SetStateAtomic32 sets or clears bit value(s) depending on state (on / off) for ordinal bit position flags, protected by atomic -- safe for concurrent access

func Toggle

func Toggle(bits *int64, flags ...int)

Toggle toggles state of bit value(s) for ordinal bit position flags

func Toggle32

func Toggle32(bits *int32, flags ...int)

Toggle32 toggles state of bit value(s) for ordinal bit position flags

func ToggleAtomic

func ToggleAtomic(bits *int64, flags ...int)

ToggleAtomic toggles state of bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access, but sequentially

func ToggleAtomic32

func ToggleAtomic32(bits *int32, flags ...int)

ToggleAtomic32 toggles state of bit value(s) for ordinal bit position flags using atomic compare-and-swap loop, safe for concurrent access, but sequentially

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL