aboutsummaryrefslogtreecommitdiff
path: root/include/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/platform.h')
-rw-r--r--include/platform.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h
index 4025561c6..128230658 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -205,6 +205,7 @@
205 205
206#include <stdint.h> 206#include <stdint.h>
207typedef int bb__aliased_int FIX_ALIASING; 207typedef int bb__aliased_int FIX_ALIASING;
208typedef long bb__aliased_long FIX_ALIASING;
208typedef uint16_t bb__aliased_uint16_t FIX_ALIASING; 209typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
209typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; 210typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
210 211
@@ -212,7 +213,8 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
212 * a lvalue. This makes it more likely to not swap them by mistake 213 * a lvalue. This makes it more likely to not swap them by mistake
213 */ 214 */
214#if defined(i386) || defined(__x86_64__) || defined(__powerpc__) 215#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
215# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp)) 216# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
217# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
216# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p)) 218# define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
217# define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p)) 219# define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
218# define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v)) 220# define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v))
@@ -221,6 +223,7 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
221#else 223#else
222/* performs reasonably well (gcc usually inlines memcpy here) */ 224/* performs reasonably well (gcc usually inlines memcpy here) */
223# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int))) 225# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
226# define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
224# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2)) 227# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
225# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4)) 228# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
226# define move_to_unaligned16(u16p, v) do { \ 229# define move_to_unaligned16(u16p, v) do { \