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 strcspn implementation #101

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

Conversation

umutoztunc
Copy link
Contributor

@umutoztunc umutoztunc commented Mar 18, 2021

I thought of implementing it using a 256-bit bitmap. Like storing characters in s2 like a blacklist to stop iteration of s1. However, it might be an overkill to create a bitmap for overall use-cases. Under most circumstances, the length of s2 should be way smaller than s1. Thus, I decided to copy the implementation from Bionic like some other functions in string.h.

I was planning to write some test cases, but I noticed there are no test cases for functions like strchr and the test structure looked a bit weird to me. It might be better to refactor the tests at some point. Still, I can write tests similar to fgets if you'd like.

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