[Vm-dev] Suspect code in LittleEndianBitmap

Eliot Miranda eliot.miranda at gmail.com
Sun Nov 3 21:04:49 UTC 2013


On Sat, Nov 2, 2013 at 3:54 PM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:

>
> I presume that the idea was to accept signed char, but interpret as
> unsigned, like a dirty cast...
>

that's the intent.  I should comment it.


>
>
> 2013/11/2 Bob Arning <arning315 at comcast.net>
>
>>
>>  Looks a bit odd. If byte is less than zero, then exit. Followed by
>> another test for byte less than zero? Looks like old and new code mixed.
>>
>> Cheers,
>> Bob
>>
>>
>>  On 11/2/13 6:30 PM, Nicolas Cellier wrote:
>>
>>
>>
>>  In recent COG, I see:
>>
>> LittleEndianBitmap>>byteAt: byteAddress put: byte
>>     "Insert a byte into a Bitmap (little-endian version).  N.B.
>> Signedness will be lost since byteAt: answers non-negative values.
>>      We can add a signedByteAt: if needed."
>>     | value longWord shift lowBits longAddr |
>>     (byte < 0 or:[byte > 255]) ifTrue:[^self errorImproperStore].
>>     value := byte < 0
>>                 ifTrue: [byte < 128 ifTrue:
>>                             [self errorImproperStore].
>>
>>  It looks suspect to me, wouldn't the intention be
>>
>>                 ifTrue: [byte < -128 ifTrue:
>>                             [self errorImproperStore].
>>
>>
>>
>>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20131103/f9051c7f/attachment.htm


More information about the Vm-dev mailing list