array

package
v0.0.0-...-1e7f4ca Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Initial number of segments to support in array.
	INITIAL_SEGMENTS int32 = 1024

	// The shift used to compute the segment associated with an index (equivalently, the logarithm of the segment size).
	SEGMENT_SHIFT int32 = 10

	// Size of a single segment of a BigArray.
	SEGMENT_SIZE int32 = 1 << SEGMENT_SHIFT

	// The mask used to compute the offset associated to an index.
	SEGMENT_MASK int32 = SEGMENT_SIZE - 1
)

Variables

View Source
var (
	INT_INSTANCE_SIZE   int32 = SizeOf(&IntBigArray{})
	INT_SIZE_OF_SEGMENT int64 = int64(SEGMENT_SIZE) * int64(INT_INSTANCE_SIZE)
)
View Source
var (
	INT_SEGMENT_MASK int32 = SEGMENT_SIZE - 1
	SMALL            int32 = 7
	MEDIUM           int32 = 40
)

Functions

func BigArrays_Offset

func BigArrays_Offset(index int64) int32

*

*
*Computes the offset associated with a given index.

func BigArrays_Segment

func BigArrays_Segment(index int64) int32

*

  • Computes the segment associated with a given index.

func CopyArrays

func CopyArrays(src []*T, srcPos int32, dest []*T, destPos int32, length int64)

func CopyInts

func CopyInts(src []int32, srcPos int32, dest []int32, destPos int32, length int64)

func CopyOf

func CopyOf(src [][]*T, length int64) [][]*T

func Displacement

func Displacement(index int64) int32

func Get

func Get(array [][]int32, index int64) int32

func QuickSort

func QuickSort(x [][]int32, from int64, to int64, comp IntComparator)

@SuppressWarnings("checkstyle:InnerAssignment")

func Segment

func Segment(index int64) int32

func Set

func Set(array [][]int32, index int64, value int32)

func SizeOf

func SizeOf(instance T) int32

func Swap

func Swap(array [][]int32, first int64, second int64)

Types

type BigArrays

type BigArrays struct {
}

type IntBigArray

type IntBigArray struct {
	// contains filtered or unexported fields
}

func NewByIntVal

func NewByIntVal(initialValue int32) *IntBigArray

func NewIntBigArray

func NewIntBigArray() *IntBigArray

func (*IntBigArray) Add

func (iy *IntBigArray) Add(index int64, value int32)

func (*IntBigArray) CopyTo

func (iy *IntBigArray) CopyTo(sourceIndex int64, destination *IntBigArray, destinationIndex int64, length int64)

func (*IntBigArray) EnsureCapacity

func (iy *IntBigArray) EnsureCapacity(length int64)

func (*IntBigArray) Fill

func (iy *IntBigArray) Fill(value int32)

func (*IntBigArray) Get

func (iy *IntBigArray) Get(index int64) int32

func (*IntBigArray) GetSegments

func (iy *IntBigArray) GetSegments() [][]int32

func (*IntBigArray) Increment

func (iy *IntBigArray) Increment(index int64)

func (*IntBigArray) Set

func (iy *IntBigArray) Set(index int64, value int32)

func (*IntBigArray) SizeOf

func (iy *IntBigArray) SizeOf() int64

type IntBigArrays

type IntBigArrays struct {
}

func NewIntBigArrays

func NewIntBigArrays() *IntBigArrays

type IntComparator

type IntComparator interface {
	Compare(k1 int32, k2 int32) int32
}

type T

type T interface{}

Jump to

Keyboard shortcuts

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