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

Fixes to getLower/UppercaseUtf8() #7

Merged
merged 1 commit into from May 21, 2017
Merged

Fixes to getLower/UppercaseUtf8() #7

merged 1 commit into from May 21, 2017

Conversation

niklas88
Copy link
Member

On e.g. ARM and POWER char is unsigned (yeah because having it signed
wasn't stupid enough they had to make it implementation defined). Thus
the > 0 check for ASCII characters doesn't work, instead check if
the most significant bit is set.

I have confirmed both the old and new behavior on my Raspberry Pi.

Also I think the size argument should take the end of the string into
account so as to never read past it even for invalid characters.

On another note I wonder if it might be faster to first take a pass over the string
to determine the final length and then allocate in one go. Then again this would
only matter if this function shows up in profiling.

On e.g. ARM and POWER char is unsigned (yeah because having it signed
wasn't stupid enough they had to make it implementation defined). Thus
the check for > 0 for ASCII characters doesn't work, instead check if
the most significant bit is set.

Also I think the size argument should take the end of the string into
account so as to never read past it even for invalid characters.
@Buchhold Buchhold merged commit 1b79c64 into ad-freiburg:master May 21, 2017
@Buchhold
Copy link
Member

Thanks again, great stuff! Btw, I have been using a style with space between arithmetic operators so far, e.g., size() - 1 Would be great to keep this consistent in the future.

@niklas88
Copy link
Member Author

Ah damn, missed a couple. I really should get used to running cpplint... By the way you might have guessed it already but I'll be joining Hannah's group in June and these pull requests are basically the product of me getting familiar with some of the code/projects and work calming down at the old job 😊

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.

None yet

2 participants