#ifndef VECTOR_OPS
#define VECTOR_OPS
-#define build_vector_type_pair(sign, size, count, count_x2) \
-typedef struct \
-{ \
- sign##size e[count]; \
-} vec_##count##x##size##sign; \
- \
-typedef struct \
-{ \
- union \
- { \
- sign##size e[count_x2]; \
- struct \
- { \
- vec_##count##x##size##sign low; \
- vec_##count##x##size##sign high; \
- }; \
- }; \
-} vec_##count_x2##x##size##sign \
-
-#define build_vector_types(sign) \
- build_vector_type_pair(sign, 8, 8, 16); \
- build_vector_type_pair(sign, 16, 4, 8); \
- build_vector_type_pair(sign, 32, 2, 4); \
- build_vector_type_pair(sign, 64, 1, 2) \
-
-build_vector_types(u);
-build_vector_types(s);
+#include "vector_types.h"
#define foreach_element(iterations, operation) \
foreach_element(8, (dest).e[_i] = \
(u8)(source_a).e[_i] | ((u8)(source_b).e[_i] << 8)) \
+#define zip_4x32b(dest, source_a, source_b) \
+ foreach_element(4, (dest).e[_i] = \
+ (u16)(source_a).e[_i] | ((u16)(source_b).e[_i] << 16)) \
+
#define zip_2x64b(dest, source_a, source_b) \
foreach_element(2, (dest).e[_i] = \
(u64)(source_a).e[_i] | ((u64)(source_b).e[_i] << 32)) \