This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Lack of fabsf on Solaris (patch included)


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]