mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
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
Fixed parfait warnings in globalDefinitions files by using a union for casts. Reviewed-by: kvn
This commit is contained in:
parent
e8d1955b5e
commit
d2a5b70cdf
6 changed files with 27 additions and 46 deletions
|
@ -558,6 +558,27 @@ inline double fabsd(double value) {
|
|||
return fabs(value);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Special casts
|
||||
// Cast floats into same-size integers and vice-versa w/o changing bit-pattern
|
||||
typedef union {
|
||||
jfloat f;
|
||||
jint i;
|
||||
} FloatIntConv;
|
||||
|
||||
typedef union {
|
||||
jdouble d;
|
||||
jlong l;
|
||||
julong ul;
|
||||
} DoubleLongConv;
|
||||
|
||||
inline jint jint_cast (jfloat x) { return ((FloatIntConv*)&x)->i; }
|
||||
inline jfloat jfloat_cast (jint x) { return ((FloatIntConv*)&x)->f; }
|
||||
|
||||
inline jlong jlong_cast (jdouble x) { return ((DoubleLongConv*)&x)->l; }
|
||||
inline julong julong_cast (jdouble x) { return ((DoubleLongConv*)&x)->ul; }
|
||||
inline jdouble jdouble_cast (jlong x) { return ((DoubleLongConv*)&x)->d; }
|
||||
|
||||
inline jint low (jlong value) { return jint(value); }
|
||||
inline jint high(jlong value) { return jint(value >> 32); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue