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

Implement KT-73565 and basic box tests for memcpy, memmove, memset and memcmp intrinsics #5385

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

Conversation

KitsuneAlex
Copy link

As described in the associated YouTrack issue, this PR aims to add memory intrinsics for Kotlin/Native for functions such as memset, memcpy, memmove and memcmp (throught libc). This allows optimizing a lot of per-element loop based functions with much faster optimized code.

I also implemented a public API for the intrinsics, supporting both untyped NativePointed addresses, and type safe extension functions for CPointer.

Very basic tests have been implemented in kt73565.kt for every function to make sure they work.

If you have any comments or nitpicks, feel free to let me know.
Cheers.

@KitsuneAlex
Copy link
Author

Adding some changes to this, i wasn't happy with the names of the extension functions for CPointer and i also forgot to add the TARGET header for the box test.

import kotlin.collections.set
import kotlin.collections.sortedBy
import kotlin.collections.toList
import kotlin.collections.toTypedArray
Copy link
Author

Choose a reason for hiding this comment

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

Don't know why my formatter did this with the project settings.. can fix if desired.

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

Successfully merging this pull request may close these issues.

1 participant