< prev index next >
src/hotspot/share/metaprogramming/primitiveConversions.hpp
Print this page
*** 102,121 ****
//
// Cast<T, U, same_size, Enable>
// Give an informative error if the sizes differ.
template<typename T, typename U>
! struct PrimitiveConversions::Cast<T, U, false> VALUE_OBJ_CLASS_SPEC {
STATIC_ASSERT(sizeof(T) == sizeof(U));
};
// Conversion between integral types.
template<typename T, typename U>
struct PrimitiveConversions::Cast<
T, U, true,
typename EnableIf<IsIntegral<T>::value && IsIntegral<U>::value>::type>
- VALUE_OBJ_CLASS_SPEC
{
T operator()(U x) const { return cast_using_union<T>(x); }
};
// Convert an enum or floating point value to an integer value.
--- 102,120 ----
//
// Cast<T, U, same_size, Enable>
// Give an informative error if the sizes differ.
template<typename T, typename U>
! struct PrimitiveConversions::Cast<T, U, false> {
STATIC_ASSERT(sizeof(T) == sizeof(U));
};
// Conversion between integral types.
template<typename T, typename U>
struct PrimitiveConversions::Cast<
T, U, true,
typename EnableIf<IsIntegral<T>::value && IsIntegral<U>::value>::type>
{
T operator()(U x) const { return cast_using_union<T>(x); }
};
// Convert an enum or floating point value to an integer value.
*** 123,133 ****
struct PrimitiveConversions::Cast<
T, U, true,
typename EnableIf<IsIntegral<T>::value &&
(IsRegisteredEnum<U>::value ||
IsFloatingPoint<U>::value)>::type>
- VALUE_OBJ_CLASS_SPEC
{
T operator()(U x) const { return cast_using_union<T>(x); }
};
// Convert an integer to an enum or floating point value.
--- 122,131 ----
*** 135,165 ****
struct PrimitiveConversions::Cast<
T, U, true,
typename EnableIf<IsIntegral<U>::value &&
(IsRegisteredEnum<T>::value ||
IsFloatingPoint<T>::value)>::type>
- VALUE_OBJ_CLASS_SPEC
{
T operator()(U x) const { return cast_using_union<T>(x); }
};
// Convert a pointer to an integral value.
template<typename T, typename U>
struct PrimitiveConversions::Cast<
T, U*, true,
typename EnableIf<IsIntegral<T>::value>::type>
- VALUE_OBJ_CLASS_SPEC
{
T operator()(U* x) const { return reinterpret_cast<T>(x); }
};
// Convert an integral value to a pointer.
template<typename T, typename U>
struct PrimitiveConversions::Cast<
T*, U, true,
typename EnableIf<IsIntegral<U>::value>::type>
- VALUE_OBJ_CLASS_SPEC
{
T* operator()(U x) const { return reinterpret_cast<T*>(x); }
};
template<typename T, typename U>
--- 133,160 ----
< prev index next >