Hi. I am trying to call #primitiveBitOr which inside calls #popPos32BitInteger which calls #positive32BitValueOf , with two LargePositiveInteger. Example:<br><br>9999999999 bitOr: 8888888888.<br> <br>Now, this seems to fail since the #bitOr: of LargePositiveInteger is failing, and thus, super (Integer) is being used. Now, I don't understand why it fails. <br>
<br>If I read the comment of positive32BitValueOf it says "Convert the given object into an integer value.<br> The object may be either a positive ST integer or a four-byte LargePositiveInteger."<br><br>Its code is:<br>
<br>positive32BitValueOf: oop<br> "Convert the given object into an integer value.<br> The object may be either a positive ST integer or a four-byte LargePositiveInteger."<br><br> | sz value |<br> (self isIntegerObject: oop) ifTrue: [<br>
value := self integerValueOf: oop.<br> value < 0 ifTrue: [^ self primitiveFail].<br> ^ value].<br><br> self assertClassOf: oop is: (self splObj: ClassLargePositiveInteger).<br> successFlag ifTrue: [<br>
sz := self lengthOf: oop.<br> sz = 4 ifFalse: [^ self primitiveFail]].<br> successFlag ifTrue: [<br> ^ (self fetchByte: 0 ofObject: oop) +<br> ((self fetchByte: 1 ofObject: oop) << 8) +<br>
((self fetchByte: 2 ofObject: oop) << 16) +<br> ((self fetchByte: 3 ofObject: oop) << 24) ].<br><br><br><br>as you can see, I am supposed to use ClassLargePositiveInteger.<br><br>But, in addition, LargePositiveInteger >> #bitOr comment says: "Primitive. Answer an Integer whose bits are the logical OR of the<br>
receiver's bits and those of the argument. Fail if the receiver or argument<br> is greater than 32 bits. See Object documentation whatIsAPrimitive."<br><br>So....I don't understand...how can I have a LargePositiveInteger but that is less than 32 bits? Wouldn't that be a SmallInteger?<br>
<br>I put some printf in the VM and seems that with my numbers (9999999999 and 8888888888.) when I sent positive32BitValueOf: I got : -65536 and 65535<br><br>Thanks in advance for any help.<br><br>Mariano<br><br>