[Vm-dev] Suspect code in LittleEndianBitmap
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Sat Nov 2 22:54:33 UTC 2013
I presume that the idea was to accept signed char, but interpret as
unsigned, like a dirty cast...
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].
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20131102/8ed894cb/attachment.htm
More information about the Vm-dev
mailing list