46
46
#include " logging/log.hpp"
47
47
#include " memory/resourceArea.hpp"
48
48
#include " memory/universe.hpp"
49
+ #include " metaprogramming/primitiveConversions.hpp"
49
50
#include " oops/compiledICHolder.inline.hpp"
50
51
#include " oops/klass.hpp"
51
52
#include " oops/method.inline.hpp"
@@ -242,12 +243,11 @@ JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y))
242
243
#ifdef _WIN64
243
244
// 64-bit Windows on amd64 returns the wrong values for
244
245
// infinity operands.
245
- union { jfloat f; juint i; } xbits, ybits;
246
- xbits.f = x;
247
- ybits.f = y;
246
+ juint xbits = PrimitiveConversions::cast<juint>(x);
247
+ juint ybits = PrimitiveConversions::cast<juint>(y);
248
248
// x Mod Infinity == x unless x is infinity
249
- if (((xbits.i & float_sign_mask) != float_infinity) &&
250
- ((ybits.i & float_sign_mask) == float_infinity) ) {
249
+ if (((xbits & float_sign_mask) != float_infinity) &&
250
+ ((ybits & float_sign_mask) == float_infinity) ) {
251
251
return x;
252
252
}
253
253
return ((jfloat)fmod_winx64((double )x, (double )y));
@@ -258,12 +258,11 @@ JRT_END
258
258
259
259
JRT_LEAF (jdouble, SharedRuntime::drem(jdouble x, jdouble y))
260
260
#ifdef _WIN64
261
- union { jdouble d; julong l; } xbits, ybits;
262
- xbits.d = x;
263
- ybits.d = y;
261
+ julong xbits = PrimitiveConversions::cast<julong>(x);
262
+ julong ybits = PrimitiveConversions::cast<julong>(y);
264
263
// x Mod Infinity == x unless x is infinity
265
- if (((xbits.l & double_sign_mask) != double_infinity) &&
266
- ((ybits.l & double_sign_mask) == double_infinity) ) {
264
+ if (((xbits & double_sign_mask) != double_infinity) &&
265
+ ((ybits & double_sign_mask) == double_infinity) ) {
267
266
return x;
268
267
}
269
268
return ((jdouble)fmod_winx64((double )x, (double )y));
0 commit comments