[K/N] Tweak aligned allocation on all platforms ^KT-37272
Merge-request: KT-MR-6341 Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
committed by
Space
parent
d7ca7e17c9
commit
1535ab8eed
@@ -3,18 +3,11 @@ import kotlin.native.*
|
||||
import kotlin.test.*
|
||||
import cvectors.*
|
||||
|
||||
fun isWin32() = Platform.osFamily == OsFamily.WINDOWS && Platform.cpuArchitecture == CpuArchitecture.X86
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val mimalloc = args.takeIf { it.size == 1 }?.get(0) == "mimalloc"
|
||||
|
||||
// See KT-37272. Fixed in mimalloc
|
||||
if (mimalloc || !isWin32()) {
|
||||
produceComplex().useContents {
|
||||
assertEquals(vec4f, vectorOf(1.0f, 1.0f, 1.0f, 1.0f))
|
||||
vec4f = vectorOf(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
assertEquals(vec4f, vectorOf(0.0f, 0.0f, 0.0f, 0.0f))
|
||||
}
|
||||
fun main() {
|
||||
produceComplex().useContents {
|
||||
assertEquals(vec4f, vectorOf(1.0f, 1.0f, 1.0f, 1.0f))
|
||||
vec4f = vectorOf(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
assertEquals(vec4f, vectorOf(0.0f, 0.0f, 0.0f, 0.0f))
|
||||
}
|
||||
|
||||
// FIXME: KT-36285
|
||||
@@ -23,13 +16,10 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
assertEquals(49, (sendV4F(vectorOf(1f, 2f, 3f, 4f)) + 0.00001).toInt())
|
||||
|
||||
if (mimalloc || !isWin32()) {
|
||||
memScoped {
|
||||
val vector = alloc<KVector4i32Var>().also {
|
||||
it.value = vectorOf(1, 2, 3, 4)
|
||||
}
|
||||
assertEquals(vector.value, vectorOf(1, 2, 3, 4))
|
||||
memScoped {
|
||||
val vector = alloc<KVector4i32Var>().also {
|
||||
it.value = vectorOf(1, 2, 3, 4)
|
||||
}
|
||||
assertEquals(vector.value, vectorOf(1, 2, 3, 4))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user