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

Consider adding a variant of memeq which reveals mismatched position #2

Open
matklad opened this issue Jul 13, 2022 · 2 comments
Open

Comments

@matklad
Copy link

matklad commented Jul 13, 2022

memeq returns a bool, but it seems sometimes it'd be useful to know the position of the mismatch.

Asked about this couple of years ago, and today was asked about this again:

https://users.rust-lang.org/t/how-to-find-common-prefix-of-two-byte-slices-effectively/25815/2

@stevenj
Copy link

stevenj commented Jul 19, 2024

This sounds more like a variant of memcmp. memcmp has to do a serial match of the byte arrays otherwise it can't return >< or =.
Memeq can use any strategy and doesn't need to be linear so the first difference it finds may not be the first difference between the arrays.

@aki-akaguma
Copy link
Owner

Thank you for your report. I'll investigate.

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

No branches or pull requests

3 participants