src/share/vm/utilities/globalDefinitions.hpp

changeset 7001
b6a8cc1e0d92
parent 6680
78bbf4d43a14
child 7535
7ae4e26cb1e0
child 8368
32b682649973
equal deleted inserted replaced
7000:631c3a4ea10c 7001: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

mercurial