diff options
author | Jack Lloyd <[email protected]> | 2019-09-25 07:58:57 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-09-25 07:58:57 -0400 |
commit | 120bab07e29f0f9d9b109144ae0779851112d9ae (patch) | |
tree | 5c61753757da4f76672a10a9de920d3b4da1dcb0 /src/lib/utils | |
parent | 9a0230b73f11654b181a04b4084af458c504552f (diff) |
Add tests for SIMD_4x32::shift_elems_{left,right}
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/simd/simd_32.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h index 2f662b98d..7de89acfc 100644 --- a/src/lib/utils/simd/simd_32.h +++ b/src/lib/utils/simd/simd_32.h @@ -425,6 +425,8 @@ class SIMD_4x32 final template<int SHIFT> SIMD_4x32 shl() const { + static_assert(SHIFT > 0 && SHIFT <= 31, "Invalid shift count"); + #if defined(BOTAN_SIMD_USE_SSE2) return SIMD_4x32(_mm_slli_epi32(m_simd, SHIFT)); @@ -510,6 +512,8 @@ class SIMD_4x32 final template<size_t I> SIMD_4x32 shift_elems_left() const { + static_assert(I <= 3, "Invalid shift count"); + #if defined(BOTAN_SIMD_USE_SSE2) return SIMD_4x32(_mm_slli_si128(raw(), 4*I)); #elif defined(BOTAN_SIMD_USE_NEON) @@ -530,6 +534,8 @@ class SIMD_4x32 final template<size_t I> SIMD_4x32 shift_elems_right() const { + static_assert(I <= 3, "Invalid shift count"); + #if defined(BOTAN_SIMD_USE_SSE2) return SIMD_4x32(_mm_srli_si128(raw(), 4*I)); #elif defined(BOTAN_SIMD_USE_NEON) |