URL
https://opencores.org/ocsvn/or1k_soc_on_altera_embedded_dev_kit/or1k_soc_on_altera_embedded_dev_kit/trunk
Show entire file |
Details |
Blame |
View Log
Rev 7 |
Rev 19 |
Line 1... |
Line 1... |
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
#ifndef _OR32_UNALIGNED_H
|
#ifndef _OR32_UNALIGNED_H
|
#define _OR32_UNALIGNED_H
|
#define _OR32_UNALIGNED_H
|
|
|
#define get_unaligned(ptr) ({ \
|
/*
|
typeof((*(ptr))) x; \
|
#define get_unaligned(ptr) ({ \
|
memcpy(&x, (void*)ptr, sizeof(*(ptr))); \
|
typeof((*(ptr))) x; \
|
x; \
|
memcpy(&x, (void*)ptr, sizeof(*(ptr))); \
|
})
|
x; \
|
|
})
|
#define put_unaligned(val, ptr) ({ \
|
|
typeof((*(ptr))) x = val; \
|
#define put_unaligned(val, ptr) ({ \
|
memcpy((void*)ptr, &x, sizeof(*(ptr))); \
|
typeof((*(ptr))) x = val; \
|
})
|
memcpy((void*)ptr, &x, sizeof(*(ptr))); \
|
|
})
|
|
*/
|
|
|
|
#define get_unaligned(ptr) \
|
|
({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
|
|
|
|
#define put_unaligned(val, ptr) \
|
|
({ __typeof__(*(ptr)) __tmp = (val); \
|
|
memmove((ptr), &__tmp, sizeof(*(ptr))); \
|
|
(void)0; })
|
|
|
#endif
|
#endif
|
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.