diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-02-04 23:42:37 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-02-04 23:42:37 -0500 |
commit | 0cf7a3850260b7e796351f5c38777f0625877d9c (patch) | |
tree | 8faa4e14a0a6555101ba49d04cfc1ce2db37002a /vec_float.h | |
parent | 7956991ebe4bc605fb70de798f9c8786634f0bd1 (diff) | |
download | vecmathlib-0cf7a3850260b7e796351f5c38777f0625877d9c.zip vecmathlib-0cf7a3850260b7e796351f5c38777f0625877d9c.tar.gz |
Provide memory access functions
Diffstat (limited to 'vec_float.h')
-rw-r--r-- | vec_float.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vec_float.h b/vec_float.h index 4b32b8b..5457ec7 100644 --- a/vec_float.h +++ b/vec_float.h @@ -219,6 +219,36 @@ namespace vecmathlib { + typedef vecmathlib::mask_t<realvec_t> mask_t; + + static realvec_t loada(real_t const* p) { return *p; } + static realvec_t loadu(real_t const* p) { return *p; } + static realvec_t loadu(real_t const* p, size_t ioff) { return p[ioff]; } + realvec_t loada(real_t const* p, mask_t const& m) const + { + return m.m.ifthen(loada(p), *this); + } + realvec_t loadu(real_t const* p, mask_t const& m) const + { + return m.m.ifthen(loadu(p), *this); + } + realvec_t loadu(real_t const* p, size_t ioff, mask_t const& m) const + { + return loadu(p+ioff, m); + } + + void storea(real_t* p) const { *p=v; } + void storeu(real_t* p) const { *p=v; } + void storeu(real_t* p, size_t ioff) const { p[ioff]=v; } + void storea(real_t* p, mask_t const& m) const { if (m.all_m) storea(p); } + void storeu(real_t* p, mask_t const& m) const { if (m.all_m) storeu(p); } + void storeu(real_t* p, size_t ioff, mask_t const& m) const + { + storeu(p+ioff, m); + } + + + intvec_t as_int() const { return FP::as_int(v); } intvec_t convert_int() const { return MF::vml_convert_int(v); } |