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

os/bluestore: clearer comments, not slower code. #16872

Merged
merged 1 commit into from Aug 10, 2017

Conversation

markhpc
Copy link
Member

@markhpc markhpc commented Aug 7, 2017

This PR reverts some of the changes introduced in #12719. In the worst case, #12719 exchanges a bitshift and logical and in the original code for a division and modulo operation. In many cases, the compiler can optimize for this internally. In this case however, because start is an int rather than uint, the original code will likely be faster than what the compiler can generate. This PR reverts the operation changes while providing comments to show what's going on instead.

if ((p[which_byte] & byte_mask) == 0) {
// byte = start / 8 (or start >> 3)
// bit = start % 8 (or start & 7)
unsigned char byte_mask = 1 << start & 7;
Copy link
Member

Choose a reason for hiding this comment

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

parens? 1 << (start & 7)

Copy link
Member Author

Choose a reason for hiding this comment

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

bah, thank you

Signed-off-by: Mark Nelson <mnelson@redhat.com>
@liewegas liewegas merged commit a09b102 into ceph:master Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants