[K/N] Fix performance build
This commit is contained in:
committed by
Space Team
parent
4081115774
commit
e1b168d77c
+2
@@ -127,7 +127,9 @@ operator fun Float32Buffer.set(index: Int, value: Float): Unit = mbuffer.setFloa
|
||||
|
||||
fun MemBufferAlloc(size: Int): MemBuffer = MemBuffer(ByteArray(size))
|
||||
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
fun MemBuffer.getFloat(index: Int): Float = data.getFloatAt(index)
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
fun MemBuffer.setFloat(index: Int, value: Float): Unit = data.setFloatAt(index, value)
|
||||
|
||||
fun MemBuffer.asFloat32Buffer(): Float32Buffer = this.sliceFloat32Buffer()
|
||||
|
||||
@@ -25,6 +25,7 @@ class Generation(private val width: Int, private val height: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
assert(neighborhood.size == 8)
|
||||
val aliveNeighbours = neighborhood
|
||||
.map { wrapOverEdge(it) }
|
||||
|
||||
@@ -22,11 +22,13 @@ private class Data(var x: Int = Random.nextInt(1000) + 1)
|
||||
private class ReferenceWrapper private constructor(
|
||||
data: Data
|
||||
) {
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
private val weak = WeakReference(data)
|
||||
private val strong = StableRef.create(data)
|
||||
|
||||
val value: Int
|
||||
get() {
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
val ref: Data? = weak.value
|
||||
if (ref == null) {
|
||||
return 0
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ actual fun writeToFile(fileName: String, text: String) {
|
||||
}
|
||||
|
||||
// Wrapper for assert funtion in stdlib
|
||||
@OptIn(kotlin.experimental.ExperimentalNativeApi::class)
|
||||
actual fun assert(value: Boolean) {
|
||||
kotlin.assert(value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user