Mercurial > hg > graal-compiler
comparison src/share/vm/utilities/globalDefinitions.hpp @ 20287:b6a8cc1e0d92
8040121: Load variable through a pointer of an incompatible type in src/hotspot/src/share/vm: opto/output.cpp, runtime/sharedRuntimeTrans.cpp, utilities/globalDefinitions_visCPP.hpp
Summary: Fixed parfait warnings in globalDefinitions files by using a union for casts.
Reviewed-by: kvn
author | thartmann |
---|---|
date | Tue, 29 Jul 2014 13:54:16 +0200 |
parents | 78bbf4d43a14 |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
20286:631c3a4ea10c | 20287:b6a8cc1e0d92 |
---|---|
555 // convert the operand to double, avoiding a dependency on __fabsf which | 555 // convert the operand to double, avoiding a dependency on __fabsf which |
556 // doesn't exist in early versions of Solaris 8. | 556 // doesn't exist in early versions of Solaris 8. |
557 inline double fabsd(double value) { | 557 inline double fabsd(double value) { |
558 return fabs(value); | 558 return fabs(value); |
559 } | 559 } |
560 | |
561 //---------------------------------------------------------------------------------------------------- | |
562 // Special casts | |
563 // Cast floats into same-size integers and vice-versa w/o changing bit-pattern | |
564 typedef union { | |
565 jfloat f; | |
566 jint i; | |
567 } FloatIntConv; | |
568 | |
569 typedef union { | |
570 jdouble d; | |
571 jlong l; | |
572 julong ul; | |
573 } DoubleLongConv; | |
574 | |
575 inline jint jint_cast (jfloat x) { return ((FloatIntConv*)&x)->i; } | |
576 inline jfloat jfloat_cast (jint x) { return ((FloatIntConv*)&x)->f; } | |
577 | |
578 inline jlong jlong_cast (jdouble x) { return ((DoubleLongConv*)&x)->l; } | |
579 inline julong julong_cast (jdouble x) { return ((DoubleLongConv*)&x)->ul; } | |
580 inline jdouble jdouble_cast (jlong x) { return ((DoubleLongConv*)&x)->d; } | |
560 | 581 |
561 inline jint low (jlong value) { return jint(value); } | 582 inline jint low (jlong value) { return jint(value); } |
562 inline jint high(jlong value) { return jint(value >> 32); } | 583 inline jint high(jlong value) { return jint(value >> 32); } |
563 | 584 |
564 // the fancy casts are a hopefully portable way | 585 // the fancy casts are a hopefully portable way |