Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more vectorOf functions to Kotlin Native #5265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alex-s168
Copy link

Title

Copy link
Contributor

@SvyatoslavScherbina SvyatoslavScherbina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR completely lacks tests for the new functions. Please add some.

@@ -57,10 +57,25 @@ public final class Vector128 private constructor() {
@GCUnsafeCall("Kotlin_Interop_Vector4f_of")
public external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128

@SinceKotlin("1.9")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument doesn't seem right -- this declaration won't appear in Kotlin 1.9. See more details here: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-since-kotlin/

KVector4f Kotlin_Interop_Vector2f64_of(KDouble d0, KDouble d1) {
KDouble __attribute__ ((__vector_size__(16))) v2d = {d0, d1};
return (KVector4f)v2d;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, it makes sense to implement those operations as compiler intrinsics. This would help avoid copy-pasting. The intrinsics are implemented here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants