Skip to content

Conversation

@findepi
Copy link
Contributor

@findepi findepi commented Jul 20, 2021

No description provided.

@google-cla google-cla bot added the cla: yes label Jul 20, 2021
@eamonnmcmanus eamonnmcmanus self-assigned this Jul 20, 2021
Copy link
Member

@eamonnmcmanus eamonnmcmanus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the idea behind this PR. The existing code has a rather weird way of implementing the UTF-8 principle where the number of high 1 bits in the first byte indicates how many bytes there are. Your rewrite makes this clearer, since the masks are 0x3, 0x7, 0xF for 2, 3, or 4 bytes respectively.

@findepi findepi force-pushed the findepi/remove-redundant-bit-masking-467c13 branch from db50046 to d0bb0fe Compare July 21, 2021 11:39
@findepi
Copy link
Contributor Author

findepi commented Jul 21, 2021

@eamonnmcmanus added assert (can replace with a comment if you prefer so).
Also added test cases which exercise edge case values.

@findepi findepi force-pushed the findepi/remove-redundant-bit-masking-467c13 branch from d0bb0fe to 8685091 Compare July 21, 2021 11:47
@findepi findepi force-pushed the findepi/remove-redundant-bit-masking-467c13 branch from 8685091 to b187f9d Compare July 21, 2021 20:22
@findepi
Copy link
Contributor Author

findepi commented Jul 21, 2021

@eamonnmcmanus changed to comments
also, added a clarifying TODO comment in the test case, where i had to use an incorrect expected value.

@eamonnmcmanus
Copy link
Member

Thanks, this looks fine. Because of the way we sync between our internal repo and GitHub, we'll be closing this PR and sending out an equivalent one, duly attributed to you.

@findepi
Copy link
Contributor Author

findepi commented Jul 22, 2021

Thanks for review

@nick-someone nick-someone added P3 no SLO package=hash type=performance Related to performance labels Jul 26, 2021
copybara-service bot pushed a commit that referenced this pull request Jul 29, 2021
Also add some more test cases for `hashString`.

Closes #5654.

RELNOTES=n/a
PiperOrigin-RevId: 386122757
@findepi findepi deleted the findepi/remove-redundant-bit-masking-467c13 branch July 30, 2021 07:17
@findepi
Copy link
Contributor Author

findepi commented Jul 30, 2021

@eamonnmcmanus thanks for merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants