diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-04-23 12:52:42 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-04-23 12:52:42 -0400 |
commit | 426aaa47ed4724b06b92cb2d1e9097d4dda20b54 (patch) | |
tree | a4c481a26683084e6dfb3e1bafc5f9fd6af56ee0 /vec_pseudo.h | |
parent | 3dddb12bf74e3373989aaf6927a90c82633601b5 (diff) | |
download | vecmathlib-426aaa47ed4724b06b92cb2d1e9097d4dda20b54.zip vecmathlib-426aaa47ed4724b06b92cb2d1e9097d4dda20b54.tar.gz |
Introduce field "alignment" describing the necessary alignment for vector types
Diffstat (limited to 'vec_pseudo.h')
-rw-r--r-- | vec_pseudo.h | 9 |
1 files changed, 6 insertions, 3 deletions
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<real_t, size> 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<real_t, size> 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 |