< prev index next >

src/hotspot/share/metaprogramming/primitiveConversions.hpp

Print this page
rev 47383 : [mq]: OrderAccess_refactoring


 150   VALUE_OBJ_CLASS_SPEC
 151 {
 152   T operator()(U* x) const { return reinterpret_cast<T>(x); }
 153 };
 154 
 155 // Convert an integral value to a pointer.
 156 template<typename T, typename U>
 157 struct PrimitiveConversions::Cast<
 158   T*, U, true,
 159   typename EnableIf<IsIntegral<U>::value>::type>
 160   VALUE_OBJ_CLASS_SPEC
 161 {
 162   T* operator()(U x) const { return reinterpret_cast<T*>(x); }
 163 };
 164 
 165 template<typename T, typename U>
 166 inline T PrimitiveConversions::cast(U x) {
 167   return Cast<T, U>()(x);
 168 }
 169 




















 170 #endif // SHARE_VM_METAPROGRAMMING_PRIMITIVECONVERSIONS_HPP


 150   VALUE_OBJ_CLASS_SPEC
 151 {
 152   T operator()(U* x) const { return reinterpret_cast<T>(x); }
 153 };
 154 
 155 // Convert an integral value to a pointer.
 156 template<typename T, typename U>
 157 struct PrimitiveConversions::Cast<
 158   T*, U, true,
 159   typename EnableIf<IsIntegral<U>::value>::type>
 160   VALUE_OBJ_CLASS_SPEC
 161 {
 162   T* operator()(U x) const { return reinterpret_cast<T*>(x); }
 163 };
 164 
 165 template<typename T, typename U>
 166 inline T PrimitiveConversions::cast(U x) {
 167   return Cast<T, U>()(x);
 168 }
 169 
 170 // jfloat and jdouble translation to integral types
 171 
 172 template<>
 173 struct PrimitiveConversions::Translate<jdouble> : public TrueType {
 174   typedef double Value;
 175   typedef int64_t Decayed;
 176 
 177   static Decayed decay(Value x) { return PrimitiveConversions::cast<Decayed>(x); }
 178   static Value recover(Decayed x) { return PrimitiveConversions::cast<Value>(x); }
 179 };
 180 
 181 template<>
 182 struct PrimitiveConversions::Translate<jfloat> : public TrueType {
 183   typedef float Value;
 184   typedef int32_t Decayed;
 185 
 186   static Decayed decay(Value x) { return PrimitiveConversions::cast<Decayed>(x); }
 187   static Value recover(Decayed x) { return PrimitiveConversions::cast<Value>(x); }
 188 };
 189 
 190 #endif // SHARE_VM_METAPROGRAMMING_PRIMITIVECONVERSIONS_HPP
< prev index next >