After further looking, it seems like the following would work for the
corresponding unsigned shift right >>> in Java to Objective C.
int k = (unsigned) k >> (0x1f & 1);
On Fri, Nov 26, 2010 at 11:14 AM, Troy Gaines <tro...@gm...> wrote:
> From what I can tell, it looks like the objective C instruction might not
> always be the same when doing a shift right. I posted the following Java
> code and corresponding Objective C code to illustrate this. In Java the
> value ends up positive and Objective C negative. I'm not sure if the left
> shift has this same issue.
>
> Thanks again!
>
> int k2 = -2147483648;
>
> k2 = k2 >>> 1;
>
> assertEquals(1073741824, k2); //this passes
>
>
> //objective c generated code
>
> int _r34.i = -2147483648;
>
> _r34.i = _r34.i >> (0x1f & 1);
>
> STAssertEquals(1073741824, _r34.i, @"Should be 1073741824 and not
> -1073741824");
>
>
|