Mercurial > vec
changeset 6:978c167dcceb
impl/gcc: dereference pointers for load/store
simpler than memcpy and apparently is how you're *supposed*
to do it anyway
author | Paper <paper@tflc.us> |
---|---|
date | Wed, 23 Oct 2024 19:05:34 -0400 |
parents | 1f070512497f |
children | 945d410803f8 6ff0b7a44bb6 |
files | include/vec/impl/gcc.h |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/include/vec/impl/gcc.h Wed Oct 23 12:51:25 2024 -0400 +++ b/include/vec/impl/gcc.h Wed Oct 23 19:05:34 2024 -0400 @@ -30,9 +30,8 @@ #define VEC_DEFINE_OPERATIONS(sign, csign, bits, size) \ VEC_DECL_LOAD_ALIGNED(sign, bits, size) \ { \ - v##sign##int##bits##x##size vec; \ - memcpy(&vec, in, sizeof(vec)); \ - return vec; \ + /* no real known alignment here */ \ + return *(v##sign##int##bits##x##size *)in; \ } \ \ VEC_DECL_LOAD(sign, bits, size) \ @@ -42,7 +41,7 @@ \ VEC_DECL_STORE_ALIGNED(sign, bits, size) \ { \ - memcpy(out, &vec, sizeof(vec)); \ + *(v##sign##int##bits##x##size *)out = vec; \ } \ \ VEC_DECL_STORE(sign, bits, size) \