Documentation ¶
Index ¶
- type Array
- func And(array1, array2 *Array) *Array
- func New() *Array
- func NewFromSlice(slice []bool) *Array
- func NewWithCapacity(initialCapacity int) *Array
- func NewWithSize(initialSize int) *Array
- func Not(array *Array) *Array
- func Or(array1, array2 *Array) *Array
- func ShiftLeft(array *Array, operationType ShiftType) *Array
- func ShiftRight(array *Array, operationType ShiftType) *Array
- func Xor(array1, array2 *Array) *Array
- func (array *Array) All() bool
- func (array *Array) And(other *Array)
- func (array *Array) Any() bool
- func (array *Array) Append(value bool)
- func (array *Array) Capacity() int
- func (array *Array) Clear()
- func (array *Array) Clone() *Array
- func (array *Array) Count() int
- func (array *Array) Flip(index int)
- func (array *Array) FlipAll()
- func (array *Array) Get(index int) bool
- func (array *Array) Insert(index int, value bool)
- func (array *Array) Join(other *Array)
- func (array *Array) None() bool
- func (array *Array) Or(other *Array)
- func (array *Array) Remove(index int)
- func (array *Array) Reverse()
- func (array *Array) Set(index int, value bool)
- func (array *Array) SetAll(value bool)
- func (array *Array) ShiftLeft(operationType ShiftType)
- func (array *Array) ShiftRight(operationType ShiftType)
- func (array *Array) Size() int
- func (array *Array) String() string
- func (array *Array) Xor(other *Array)
- type ShiftType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
Array is an optimized array of boolean values. The zero value is ready to use. Do not copy a non-zero Array.
func NewFromSlice ¶
NewFromSlice creates an Array from the specified slice.
func NewWithCapacity ¶
NewWithCapacity creates an empty Array with the specified initial capacity.
func NewWithSize ¶
NewWithSize creates an empty Array with the specified initial size.
func ShiftLeft ¶
ShiftLeft performs bitwise left shift operation on an array and returns the result.
func ShiftRight ¶
ShiftRight performs bitwise right shift operation on an array and returns the result.
func (*Array) Capacity ¶
Capacity returns the number of bits that the Array can hold without reallocating.
func (*Array) Get ¶
Get returns the bit at the specified index. Negative indices are interpreted as relative to the end of the Array. Panics if the index is out of bounds.
func (*Array) Reverse ¶
func (array *Array) Reverse()
Reverse reverses the order of the bits in the Array.
func (*Array) Set ¶
Set sets the bit at the specified index to the specified value. Negative indices are interpreted as relative to the end of the Array. Panics if the index is out of bounds.
func (*Array) ShiftRight ¶
ShiftRight performs an in-place right shift operation on the array.
type ShiftType ¶
type ShiftType uint8
ShiftType is an enum for the type of shift operation to perform.
const ( FillZero ShiftType = iota // FillZero is a shift type that fills the empty bits with zeros. FillOne // FillOne is a shift type that fills the empty bits with ones. Arithmetic /* Arithmetic is a shift type that fills the empty bits with the same value as the sign bit during a right shift, and with zeros during a left shift. */ )