diff options
author | Mateusz Chudyk <mateuszchudyk@gmail.com> | 2019-07-09 17:27:46 +0300 |
---|---|---|
committer | Mateusz Chudyk <mateuszchudyk@gmail.com> | 2019-07-09 22:39:50 +0300 |
commit | 1115cc6c3e65115bd5a36c9615bc20186a5a0746 (patch) | |
tree | 0146862dc8ecaa13f859ae00de428e1f7d179804 | |
parent | ab876d8d42687fb1ccc1dc2eecd0abb8e9e7cd99 (diff) |
Add Write kernel for others vector types
-rw-r--r-- | kernels/implementations.inl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernels/implementations.inl b/kernels/implementations.inl index 2c14429..7e0641d 100644 --- a/kernels/implementations.inl +++ b/kernels/implementations.inl @@ -34,6 +34,15 @@ namespace kernels { /* * Write */ +CPU_ATTR static inline void write(vi input, int* output, Index offset) { + *reinterpret_cast<vi*>(output + offset) = input; +} + +CPU_ATTR static inline void write(dvi input, int* output, Index offset) { + write(input.first, output, offset); + write(input.second, output, offset + sizeof(dvi::type) / 4); +} + CPU_ATTR static inline void write(vf input, float* output, Index offset) { *reinterpret_cast<vf*>(output + offset) = input; } @@ -43,6 +52,15 @@ CPU_ATTR static inline void write(dvf input, float* output, Index offset) { write(input.second, output, offset + sizeof(dvf::type) / 4); } +CPU_ATTR static inline void write(vd input, double* output, Index offset) { + *reinterpret_cast<vd*>(output + offset) = input; +} + +CPU_ATTR static inline void write(dvd input, double* output, Index offset) { + write(input.first, output, offset); + write(input.second, output, offset + sizeof(dvd::type) / 8); +} + /* * Quantize */ |