[Vm-dev] VM Maker: VMMaker.oscog-eem.1497.mcz
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Wed Oct 21 23:07:54 UTC 2015
2015-10-21 1:07 GMT+02:00 <commits at source.squeak.org>:
>
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1497.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-eem.1497
> Author: eem
> Time: 20 October 2015, 4:07:03.853 pm
> UUID: 0719f4d7-3dd5-4f5c-bc36-07461475c215
> Ancestors: VMMaker.oscog-eem.1496
>
> Make sure signed comparisons are used in the relevamt isIntegerValue:
> implementations.
>
> =============== Diff against VMMaker.oscog-eem.1496 ===============
>
> Item was changed:
> ----- Method: ObjectMemory>>isIntegerValue: (in category 'interpreter
> access') -----
> isIntegerValue: intValue
> "Answer if the given value can be represented as a Smalltalk
> integer value.
> In C, use a shift and XOR to set the sign bit if and only if the
> top two bits of the given
> value are the same, then test the sign bit. Note that the top two
> bits are equal for
> exactly those integers in the range that can be represented in
> 31-bits or 63-bits."
> <api>
> ^self
> + cCode: [(intValue bitXor: (intValue << 1)) asInteger >= 0]
> - cCode: [(intValue bitXor: (intValue << 1)) >= 0]
> inSmalltalk: [intValue >= 16r-40000000 and: [intValue <=
> 16r3FFFFFFF]]!
>
>
To be even more pedantic and warnig free, this is what I have since March:
^self
cCode: [(intValue asUnsignedInteger bitXor: (intValue
asUnsignedInteger << 1)) asInteger >= 0]
inSmalltalk: [intValue >= self minSmallInteger and: [intValue <=
self maxSmallInteger]]
> Item was changed:
> ----- Method: Spur32BitMemoryManager>>isIntegerValue: (in category
> 'interpreter access') -----
> isIntegerValue: intValue
> "Answer if the given value can be represented as a Smalltalk
> integer value.
> In C, use a shift and XOR to set the sign bit if and only if the
> top two bits of the given
> value are the same, then test the sign bit. Note that the top two
> bits are equal for
> exactly those integers in the range that can be represented in
> 31-bits or 63-bits."
> <api>
> ^self
> + cCode: [(intValue bitXor: (intValue << 1)) asInteger >= 0]
> - cCode: [(intValue bitXor: (intValue << 1)) >= 0]
> inSmalltalk: [intValue >= 16r-40000000 and: [intValue <=
> 16r3FFFFFFF]]!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151022/0f6ed454/attachment.htm
More information about the Vm-dev
mailing list