[Vm-dev] Re: Incorrect usage of || (logical or) instead of |
(bitwise or)
Eliot Miranda
eliot.miranda at gmail.com
Sat Mar 21 17:47:01 UTC 2015
Thanks Nicolas,
I did find a couple of others. My bad :(
On Wed, Mar 18, 2015 at 3:37 PM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:
>
> Jamais deux sans trois
>
> 2015-03-18 23:33 GMT+01:00 Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com>:
>
>> Hi,
>> Among the compiler warnings, I noticed an incorrect usage of || in
>> generated C:
>> in okayOoop:
>>
>> unusedBits = (1 << 22) || (1LL << (22 + 32));
>> if (((long64At(oop)) & unusedBits) != 0) {
>> error("some unused header bits are set; should be zero");
>> return 0;
>> }
>> unusedBitsInYoungObjects = ((1 << 0x1F) || (1 << 30)) || (1 << 29);
>> if (((longAt(oop)) & unusedBitsInYoungObjects) != 0) {
>> error("some header bits unused in young objects are set; should
>> be zero");
>> return 0;
>>
>> C || will generate 1 in this case (true) but not the intended bit mask.
>> This is because Smalltalk slang is written with | instead of bitOr:
>>
>> Find correction in attachment.
>>
>> Nicolas
>>
>
>
>
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150321/84902c51/attachment.htm
More information about the Vm-dev
mailing list