hotspot/src/cpu/x86/vm/bytes_x86.hpp
changeset 46619 a3919f5e8d2b
parent 46504 38048d4d20e7
child 46625 edefffab74e2
equal deleted inserted replaced
46618:d503911aa948 46619:a3919f5e8d2b
    41   static inline T get_native(const void* p) {
    41   static inline T get_native(const void* p) {
    42     assert(p != NULL, "null pointer");
    42     assert(p != NULL, "null pointer");
    43 
    43 
    44     T x;
    44     T x;
    45 
    45 
    46     if (is_ptr_aligned(p, sizeof(T))) {
    46     if (is_aligned(p, sizeof(T))) {
    47       x = *(T*)p;
    47       x = *(T*)p;
    48     } else {
    48     } else {
    49       memcpy(&x, p, sizeof(T));
    49       memcpy(&x, p, sizeof(T));
    50     }
    50     }
    51 
    51 
    54 
    54 
    55   template <typename T>
    55   template <typename T>
    56   static inline void put_native(void* p, T x) {
    56   static inline void put_native(void* p, T x) {
    57     assert(p != NULL, "null pointer");
    57     assert(p != NULL, "null pointer");
    58 
    58 
    59     if (is_ptr_aligned(p, sizeof(T))) {
    59     if (is_aligned(p, sizeof(T))) {
    60       *(T*)p = x;
    60       *(T*)p = x;
    61     } else {
    61     } else {
    62       memcpy(p, &x, sizeof(T));
    62       memcpy(p, &x, sizeof(T));
    63     }
    63     }
    64   }
    64   }