[PATCH] [libcxx] Fix __is_power2 and __next_power2. Change hashmap to handle new behavior.
Dan Albert
danalbert at google.com
Sun Aug 17 21:20:55 PDT 2014
Any chance those performance tests could be checked in?
On Sun, Aug 17, 2014 at 7:15 PM, Howard Hinnant <howard.hinnant at gmail.com>
wrote:
> On Aug 17, 2014, at 9:22 PM, Eric Fiselier <eric at efcs.ca> wrote:
>
> > Hi Howard,
> >
> > Thanks for the advice. I'll make sure to performance test these changes
> without moving forward.
> > I also appreciate the insight.
> >
> > > 0 is a valid bucket count. An upward bump of 0 buckets goes to 2.
> > 1 is considered not a power of 2, but it rounded up to 2.
> > 2 is considered prime, not a power of 2. Thus a upward bump off bucket
> size 2 goes to 5, not 4.
> >
> > Are you referring to the input/output from the __next_power2 function?
> > Passing 1 to __next_power2 causes undefined behavior because it passes 0
> to __clz.
> >
> > I'll consider just backing out these changes and renaming the functions
> so they don't imply mathematical accuracy.
>
> I’m not saying you should back them out. I honestly don’t know. I’m just
> saying one should tread with caution here, and use measurement to guide the
> way.
>
> The bottom line is really really how rehash behaves, since the __functions
> are all implementation details. And these __functions were purposefully
> implemented just to serve __hash_table, and are not general purpose
> facilities.
>
> Howard
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140817/4c1a0c51/attachment.html>
More information about the cfe-commits
mailing list