type

IntArray

src @Js
class IntArray : Obj

Optimized fixed size array of 1, 2, 4, or 8 byte unboxed integers. The array values default to zero.

methods

copyFrom

Copy the integers from that array into this array and return this.

fill

Fill this array with the given integer value.

get

Get the integer at the given index.

makeS1

Create a signed 8-bit, 1-byte integer array (-128 to 127).

makeS2

Create a signed 16-bit, 2-byte integer array (-32_768 to 32_767).

makeS4

Create a signed 32-bit, 4-byte integer array (-2_147_483_648 to 2_147_483_647).

makeS8

Create a signed 64-bit, 8-byte integer array.

makeU1

Create a unsigned 8-bit, 1-byte integer array (0 to 255).

makeU2

Create a unsigned 16-bit, 2-byte integer array (0 to 65_535).

makeU4

Create a unsigned 32-bit, 4-byte integer array (0 to 4_294_967_295).

set

Set the integer at the given index.

size

Get number of integers in the array

sort

Sort the integers in this array.

Slot Details

copyFrom

src This copyFrom(IntArray that, Range? thatRange := null, Int thisOffset := 0)

Copy the integers from that array into this array and return this. The thatRange parameter may be used to specify a specific range of integers from the that parameter (negative indices are allowed) to copy. If thatRange is null then the entire range of that is copied. Or thisOffset specifies the starting index of this index to copy the first integer. Raise an exception if this array is not properly sized or is not of the same signed/byte count as the that array.

fill

src This fill(Int val, Range? range := null)

Fill this array with the given integer value. If range is null then the entire array is filled, otherwise just the specified range. Return this.

get

src @Operator
Int get(Int index)

Get the integer at the given index. Negative indices are not supported.

makeS1

src static IntArray makeS1(Int size)

Create a signed 8-bit, 1-byte integer array (-128 to 127).

makeS2

src static IntArray makeS2(Int size)

Create a signed 16-bit, 2-byte integer array (-32_768 to 32_767).

makeS4

src static IntArray makeS4(Int size)

Create a signed 32-bit, 4-byte integer array (-2_147_483_648 to 2_147_483_647).

makeS8

src static IntArray makeS8(Int size)

Create a signed 64-bit, 8-byte integer array.

makeU1

src static IntArray makeU1(Int size)

Create a unsigned 8-bit, 1-byte integer array (0 to 255).

makeU2

src static IntArray makeU2(Int size)

Create a unsigned 16-bit, 2-byte integer array (0 to 65_535).

makeU4

src static IntArray makeU4(Int size)

Create a unsigned 32-bit, 4-byte integer array (0 to 4_294_967_295).

set

src @Operator
Void set(Int index, Int val)

Set the integer at the given index. Negative indices are not supported.

size

src Int size()

Get number of integers in the array

sort

src This sort(Range? range := null)

Sort the integers in this array. If range is null then the entire array is sorted, otherwise just the specified range. Return this.