RFR: 8183544: Missing parentheses in is_size_aligned_ macro

Stefan Karlsson stefan.karlsson at oracle.com
Wed Jul 5 10:46:27 UTC 2017


On 2017-07-05 03:02, Kim Barrett wrote:
>> On Jul 4, 2017, at 10:24 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
>>
>> Hi all,
>>
>> Please review this trivial patch to add parentheses to the is_aligned_ macro (used to be named is_size_aligned_).
>>
>> http://cr.openjdk.java.net/~stefank/8183544/webrev.00/
>>
>> MikaelG found this issue while reviewing another patch.
>>
>> Thanks,
>> StefanK
> 
> I'm confused by the existing definition.  Why isn't it
> 
> #define is_aligned_(size, alignment) (((size) & align_mask(alignment)) == 0)
> 
> That seems like it would be simpler, faster, and avoid multiple
> evaluation of the size expression.

I don't know. Maybe because it's a tad bit more readable in this 
"high-level" version, for some?

I created and will fix:
https://bugs.openjdk.java.net/browse/JDK-8183570

StefanK

> 


More information about the hotspot-dev mailing list