[Webkit-unassigned] [Bug 174232] Reimplement bmalloc::log2 for MSVC

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 6 21:46:36 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=174232

--- Comment #3 from Daewoong Jang <daewoong.jang at navercorp.com> ---
(In reply to Yusuke Suzuki from comment #2)
> Comment on attachment 314788 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=314788&action=review
> 
> > Source/bmalloc/bmalloc/Algorithm.h:137
> > -    return bitCount<unsigned long>() - 1 - __builtin_clzl(value);
> > +    return value < 2 ? 0 : 1 + log2(value / 2);
> 
> We should keep the current efficient log2 for non-Windows environment.
> If this is not constexpr, in Windows, you can use _BitScanReverse64 /
> _BitScanReverse. But maybe they are not constexpr.

_BitScanReverse is not constexpr, so I did it this way. If we have to keep current implementation, then I'll put a compiler guard around the code.

Thank you for reviewing!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170707/a1c5c8b9/attachment.html>


More information about the webkit-unassigned mailing list