From 426aaa47ed4724b06b92cb2d1e9097d4dda20b54 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 23 Apr 2013 12:52:42 -0400 Subject: Introduce field "alignment" describing the necessary alignment for vector types --- vec_pseudo.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vec_pseudo.h') diff --git a/vec_pseudo.h b/vec_pseudo.h index 95894fd..a319502 100644 --- a/vec_pseudo.h +++ b/vec_pseudo.h @@ -32,6 +32,7 @@ namespace vecmathlib { static int const size = N; typedef bool scalar_t; typedef uint_t bvector_t[size]; + static int const alignment = sizeof(bvector_t); typedef boolpseudovec boolvec_t; typedef intpseudovec intvec_t; @@ -49,7 +50,7 @@ namespace vecmathlib { - bvector_t v __attribute__((__aligned__(sizeof(bvector_t)))); + bvector_t v __attribute__((__aligned__(alignment))); boolpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't @@ -133,6 +134,7 @@ namespace vecmathlib { static int const size = N; typedef int_t scalar_t; typedef int_t ivector_t[size]; + static int const alignment = sizeof(ivector_t); typedef boolpseudovec boolvec_t; typedef intpseudovec intvec_t; @@ -150,7 +152,7 @@ namespace vecmathlib { - ivector_t v __attribute__((__aligned__(sizeof(ivector_t)))); + ivector_t v __attribute__((__aligned__(alignment))); intpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't @@ -403,6 +405,7 @@ namespace vecmathlib { static int const size = N; typedef real_t scalar_t; typedef real_t vector_t[size]; + static int const alignment = sizeof(vector_t); static char const* name() { @@ -471,7 +474,7 @@ namespace vecmathlib { - vector_t v __attribute__((__aligned__(sizeof(vector_t)))); + vector_t v __attribute__((__aligned__(alignment))); realpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't -- cgit v1.1