Lack of fabsf on Solaris (patch included)

Andrew Haley aph@redhat.com
Thu Jan 25 06:11:00 GMT 2001


Cedric Berger writes:
 > This could suggest a more efficient code, if the compiler is smart
 > enough to keep x in a register:
 > 	
 >    jfloat java::lang::Math::abs(jfloat x)
 >    {
 >         return *((uint32_t *)&x) ^ 0x80000000U;
 >    }

This isn't legal C.  You're accessing an lvalue through an lvalue of a
different type.  Use a union if you need to do this.

Andrew.


More information about the Java mailing list