< prev index next >
src/cpu/x86/vm/bytes_x86.hpp
Print this page
*** 41,51 ****
static inline T get_native(const void* p) {
assert(p != NULL, "null pointer");
T x;
! if (is_ptr_aligned(p, sizeof(T))) {
x = *(T*)p;
} else {
memcpy(&x, p, sizeof(T));
}
--- 41,51 ----
static inline T get_native(const void* p) {
assert(p != NULL, "null pointer");
T x;
! if (is_aligned(p, sizeof(T))) {
x = *(T*)p;
} else {
memcpy(&x, p, sizeof(T));
}
*** 54,64 ****
template <typename T>
static inline void put_native(void* p, T x) {
assert(p != NULL, "null pointer");
! if (is_ptr_aligned(p, sizeof(T))) {
*(T*)p = x;
} else {
memcpy(p, &x, sizeof(T));
}
}
--- 54,64 ----
template <typename T>
static inline void put_native(void* p, T x) {
assert(p != NULL, "null pointer");
! if (is_aligned(p, sizeof(T))) {
*(T*)p = x;
} else {
memcpy(p, &x, sizeof(T));
}
}
< prev index next >