Skip to content

Conversation

@oranagra
Copy link
Member

using bit hack to find the next power of 2.
also notice that LONG_MAX (previously used) was not a power of 2 at all.

@antirez
Copy link
Contributor

antirez commented Feb 11, 2015

This makes no difference at all , practically ;-) And is more complex. It is worth it when you have to compute a lot of next power ops, but here, you do that only during rehashing or alike, it will never be measurable. Simpler code instead is measurably better. Thanks anyway!

@antirez antirez closed this Feb 11, 2015
@oranagra
Copy link
Member Author

ok, but please notice what i said about LONG_MAX (not a power of 2 at all)

@mattsta
Copy link
Contributor

mattsta commented Feb 11, 2015

Yeah, that's been a bug forever. The proper value would be LONG_MAX+1.

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.

3 participants