|
|
|
@@ -10,6 +10,10 @@ import kotlin.wasm.internal.*
|
|
|
|
|
public class ByteArray(size: Int) {
|
|
|
|
|
internal val storage = WasmByteArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmByteArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Byte) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -40,6 +44,10 @@ internal fun byteArrayIterator(array: ByteArray) = object : ByteIterator() {
|
|
|
|
|
public class CharArray(size: Int) {
|
|
|
|
|
internal val storage = WasmCharArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmCharArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Char) : this(size) {
|
|
|
|
|
storage.fill(size) { init(it) }
|
|
|
|
|
}
|
|
|
|
@@ -71,6 +79,10 @@ internal fun charArrayIterator(array: CharArray) = object : CharIterator() {
|
|
|
|
|
public class ShortArray(size: Int) {
|
|
|
|
|
internal val storage = WasmShortArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmShortArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Short) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -102,6 +114,10 @@ internal fun shortArrayIterator(array: ShortArray) = object : ShortIterator() {
|
|
|
|
|
public class IntArray(size: Int) {
|
|
|
|
|
internal val storage = WasmIntArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmIntArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Int) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -133,6 +149,10 @@ internal fun intArrayIterator(array: IntArray) = object : IntIterator() {
|
|
|
|
|
public class LongArray(size: Int) {
|
|
|
|
|
internal val storage = WasmLongArray (size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmLongArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Long) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -163,6 +183,10 @@ internal fun longArrayIterator(array: LongArray) = object : LongIterator() {
|
|
|
|
|
public class FloatArray(size: Int) {
|
|
|
|
|
internal val storage = WasmFloatArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmFloatArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Float) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -193,6 +217,10 @@ internal fun floatArrayIterator(array: FloatArray) = object : FloatIterator() {
|
|
|
|
|
public class DoubleArray(size: Int) {
|
|
|
|
|
internal val storage = WasmDoubleArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmDoubleArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Double) : this(size) {
|
|
|
|
|
storage.fill(size, init)
|
|
|
|
|
}
|
|
|
|
@@ -223,6 +251,10 @@ internal fun doubleArrayIterator(array: DoubleArray) = object : DoubleIterator()
|
|
|
|
|
public class BooleanArray(size: Int) {
|
|
|
|
|
internal val storage = WasmByteArray(size)
|
|
|
|
|
|
|
|
|
|
@Suppress("TYPE_PARAMETER_AS_REIFIED")
|
|
|
|
|
@WasmPrimitiveConstructor
|
|
|
|
|
internal constructor(storage: WasmByteArray) : this(check(false) as Int)
|
|
|
|
|
|
|
|
|
|
public constructor(size: Int, init: (Int) -> Boolean) : this(size) {
|
|
|
|
|
storage.fill(size) { init(it).toInt().reinterpretAsByte() }
|
|
|
|
|
}
|
|
|
|
|