I have wasted most of the day on this problem
I’m currently porting another 2D physics library, this one on a par with the complexity of Box2D. It will form the basis of a game I have in mind. It’ll be open sourced when done.
The library makes extensive use of Java’s >>
and >>>
operators and they have been driving me bananas all day because I can’t seem to port them correctly to Xojo.
The >>
operator is the signed right shift operator. That is, it shifts all bits in the integral passed to it x
places to right preserving the sign bit. The >>>
operator however is the unsigned right shift operator. That means that it’ll shift the bits to the right, filling in the left-hand bits with 0’s.
From my experiments, I’m hitting a couple of issues. The main one is that I think Xojo’s Bitwise.ShiftRight()
method is equivalent to Java’s >>
operator although I’m seeing strange results depending on the numBits
optional parameter that I don’t fully understand. If I’m correct in assuming that Bitwise.ShiftRight()
is equivalent to >>
, does anyone have an approach I can use to mimic the >>>
operator?