This commit is contained in:
2025-09-22 13:02:35 +02:00
parent c32b20e5b3
commit 5b95c4dd64
41 changed files with 998 additions and 152 deletions

View File

@@ -0,0 +1,26 @@
package blitz.math
import blitz.annotations.Immutable
@Immutable
@JvmInline
@Suppress("NOTHING_TO_INLINE")
value class Vec4s(val packed: ULong) {
inline val x: Short get() = (packed shr 48).toUShort().toShort()
inline val y: Short get() = (packed shr 32).toUShort().toShort()
inline val z: Short get() = (packed shr 16).toUShort().toShort()
inline val w: Short get() = packed.toUShort().toShort()
constructor(x: Short, y: Short, z: Short, w: Short): this(
(x.toUShort().toULong() shl 48) or
(y.toUShort().toULong() shl 32) or
(z.toUShort().toULong() shl 16) or
w.toUShort().toULong())
override fun toString() = "($x, $y, $z, $w)"
inline operator fun component1() = x
inline operator fun component2() = y
inline operator fun component3() = z
inline operator fun component4() = w
}