Logical shift right problem on alpha_osf32

Eduardo Takahashi takahasi+ at cs.cmu.edu
Thu Apr 24 12:34:39 PDT 1997


I noticed a problem with the logical shift right operation (>>>)
on the alpha_osf32 platform (works fine on other platforms)
The sign is being propagated to the right, producing wrong results,
as can be verified using this simple test:

class Shiftright {

    static void ShR() {

	int unsigned = 0x80000000;

	System.out.println(unsigned);
	unsigned = unsigned >>> 24;
	System.out.println(unsigned);
    }

    public static void main (String[] args) {

	ShR();
    }
}

The output is:

-2147483648
-128

when it should be:

-2147483648
128

I found that when trying to decode Internet addresses from int's.
Couldn't figure out what is wrong though (don't have alpha assembly
documentation available).

Any suggestions?

Thanks,

-Eduardo



More information about the kaffe mailing list