[squeak-dev] <LargePositiveInteger>>BitAnd:> method not needed
Ralph Boland
rpboland at gmail.com
Fri Jun 21 01:46:52 UTC 2013
I am using Squeak 3.11. I assume the same results apply to Squeak 4.4.
If not, my apologies.
In Squeak if I evaluate:
1) ((2 << 256) bitAnd: (2 << 128)) ==> 0
2) ((2 << 256) bitAnd: (2 << 128)) class ==> SmallInteger
3) (2 << 128) ==>
680564733841876926926749214863536422912
4) ((2 << 128) bitAnd: (2 << 128)) ==>
680564733841876926926749214863536422912
This all looks correct and I care because I need to do <bitAnd:> of some
largePositiveIntegers.
But <LargePositiveInteger>>BitAnd:> is:
"Primitive. Answer an Integer whose bits are the logical AND of the
receiver's bits and those of the argument. Fail if the receiver or
argument
is greater than 32 bits. See Object documentation whatIsAPrimitive."
<primitive: 14>
self halt. "I ADDED THE HALT"
^ super bitAnd: anInteger
The way I see it <LargePositiveInteger>>BitAnd:> is always going to fail
and thus invoke its super version
(<LargePositiveInteger>>BitAnd:>) and this is what I see when I run the
code; i.e. I hit the halt.
So why have <LargePositiveInteger>>BitAnd:> method at all?
Ditto for the other bit operations.
Ralph Boland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130620/48c665c2/attachment.htm
More information about the Squeak-dev
mailing list
|