[Vm-dev] intAt from sqMemoryAccess.h does not extend sign
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Tue Nov 8 02:29:05 UTC 2016
In this code:
static inline sqInt intAtPointer(char *ptr) { return
(sqInt)(*((unsigned int *)ptr)); }
static inline sqInt intAtPointerput(char *ptr, int val) { return
(sqInt)(*((unsigned int *)ptr)= val); }
the usage of unsigned int is questionable...
It means that intAt and long32At won't perform sign extension in 64bits
Spur VM.
Since it returns a signed result (sqInt), that's troubling.
The sole real sender of intAt seems to be primitiveIntegerAt: which fails
for this reason on 64bits spur when fed with negative integers.
For long32At, it's difficult to analyze: many senders!
IMO, if we don't want a signed quantity, we should better write
unsignedLong32At (or use lowcode uint32AtPointer which answers a 32 bits
result)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20161108/27b107be/attachment.html>
More information about the Vm-dev
mailing list