Skip to content

Optional SIMD memrchr #598

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Optional SIMD memrchr #598

wants to merge 1 commit into from

Conversation

ncruces
Copy link
Contributor

@ncruces ncruces commented Jul 18, 2025

Continuing #580. memrchr is mostly used to implement strrchr, so that's what I test.

It has the advantage that we know the length and can access the entire buffer, so no undefined behavior for this one. I does do unaligned reads, however, so wasm_v128_load is used to dereference the pointer. It uses SIMD while there are 16 or more bytes to read, then fallback to scalar.

The only other notable feature is using clz rather than ctz.

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