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

Fix parse_skipped for parsing zeroes #10

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

orlp
Copy link
Contributor

@orlp orlp commented Nov 28, 2023

Fixes #9.

@RoDmitry RoDmitry merged commit ecf1955 into RoDmitry:master Nov 28, 2023
5 checks passed
@RoDmitry
Copy link
Owner

Thank you!

@RoDmitry
Copy link
Owner

RoDmitry commented Nov 28, 2023

Optimized to:

let len_1 = s.len() - 1;
while i < len_1 && *s.get_safe_unchecked(i) == b'0' {
      i += 1;
}

@orlp
Copy link
Contributor Author

orlp commented Nov 29, 2023

@RoDmitry Pretty sure the compiler would generate identical code for that.

@RoDmitry
Copy link
Owner

RoDmitry commented Nov 29, 2023

Sadly, but it's not. And sometimes I am very disappointed in a compiler, because I had to even do this. it's usize, it can't go there, but anyway in assembly there was panic (if I remember correctly).

@RoDmitry
Copy link
Owner

RoDmitry commented Nov 29, 2023

Also functions with only one line of code, you would think that they're gonna be inlined, but it might not. It would not hurt to actually write #[inline].

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.

parse_skipped can't parse zeros
2 participants