RFR(S): 8007986: GrowableArray should implement binary search

Vitaly Davidovich vitalyd at gmail.com
Fri Feb 12 00:33:33 UTC 2016


Optimize better how? The concern here would be idiv but gcc seems to
strength reduce this code without uint just fine.

On Thursday, February 11, 2016, John Rose <john.r.rose at oracle.com> wrote:

> The uint cast version might optimize better which is why I didn't suggest
> the half-difference idiom.
>
> And also this should be a macro or function in globalDefinitions.hpp
>
> Life is too short to rediscover correct C expression semantics at every
> use point.
>
> – John
>
> On Feb 11, 2016, at 3:48 PM, Vitaly Davidovich <vitalyd at gmail.com
> <javascript:_e(%7B%7D,'cvml','vitalyd at gmail.com');>> wrote:
>
> Perhaps
>
> mid = min + (max - min)/2
>
> is better?
>
> On Thursday, February 11, 2016, John Rose <john.r.rose at oracle.com
> <javascript:_e(%7B%7D,'cvml','john.r.rose at oracle.com');>> wrote:
>
>> On Feb 11, 2016, at 4:46 AM, Roland Westrelin <
>> roland.westrelin at oracle.com> wrote:
>>
>>
>> overflow issue in the binary search
>>
>>
>> The outer parens look wrong on the fix.  You want to cast to int *after*
>> dividing by two, I think.
>>
>> — John
>>
>
>
> --
> Sent from my phone
>
>

-- 
Sent from my phone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160211/4d27edba/attachment-0001.html>


More information about the hotspot-compiler-dev mailing list