comparison src/impl/x86/mmx.c @ 24:e49e70f7012f

impl/x86: add static assertions for alignment and size
author Paper <paper@tflc.us>
date Sun, 24 Nov 2024 03:32:53 -0500
parents e26874655738
children
comparison
equal deleted inserted replaced
23:e26874655738 24:e49e70f7012f
68 #define VEC_MMX_DEFINE_OPERATIONS_SIGN(sign, bits, size) \ 68 #define VEC_MMX_DEFINE_OPERATIONS_SIGN(sign, bits, size) \
69 union v##sign##int##bits##x##size##_impl_data { \ 69 union v##sign##int##bits##x##size##_impl_data { \
70 v##sign##int##bits##x##size vec; \ 70 v##sign##int##bits##x##size vec; \
71 __m64 mmx; \ 71 __m64 mmx; \
72 }; \ 72 }; \
73 \
74 VEC_STATIC_ASSERT(VEC_ALIGNOF(__m64) <= VEC_ALIGNOF(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " alignment needs to be expanded to fit intrinsic type size"); \
75 VEC_STATIC_ASSERT(sizeof(__m64) <= sizeof(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " needs to be expanded to fit intrinsic type size"); \
73 \ 76 \
74 static v##sign##int##bits##x##size v##sign##int##bits##x##size##_mmx_load_aligned(const vec_##sign##int##bits in[size]) \ 77 static v##sign##int##bits##x##size v##sign##int##bits##x##size##_mmx_load_aligned(const vec_##sign##int##bits in[size]) \
75 { \ 78 { \
76 v##sign##int##bits##x##size vec; \ 79 v##sign##int##bits##x##size vec; \
77 memcpy(&vec, in, sizeof(vec)); \ 80 memcpy(&vec, in, sizeof(vec)); \