[Vm-dev] primitiveBitShift

Helmut Rohregger helmut.rohregger at gmail.com
Mon Apr 15 09:31:33 UTC 2013


Hi all,

i am interested in the implementations of primitives in the VMMaker 
package and found some code, which i think may be implemented incorrectly.
Maybe some of you can help me out and correct me if i am wrong.

Its located in InterpreterPrimitives>>#primitiveBitShift (VMMaker-dtl.319):
the code: "self success: integerArgument <= 31" checks, if we lose bits 
by shifting to the left. This is because of processing SmallIntegers 
here, isn't it? But a "1 bitShift: 31" will produce a 
LargePositiveInteger instead of a SmallInteger. In fact a left shift of 
30 will produce a LargePositiveInteger too.

I know the code works, because the resulting object gets checked being a 
SmallInteger and fails if not. But the correct check would be "self 
success: integerArgument <= 29", isn't it?
What do you think?

- helmut




More information about the Vm-dev mailing list