Skip to content

Commit

Permalink
add span-based load/store methods for SIMD_4x32
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Aug 5, 2024
1 parent 13edb92 commit c3d9b40
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/utils/simd/simd_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <botan/types.h>

#include <span>

#if defined(BOTAN_TARGET_SUPPORTS_SSE2)
#include <emmintrin.h>
#define BOTAN_SIMD_USE_SSE2
Expand Down Expand Up @@ -186,6 +188,10 @@ class SIMD_4x32 final {
#endif
}

static SIMD_4x32 load_le(std::span<const uint8_t, 16> in) { return SIMD_4x32::load_le(in.data()); }

static SIMD_4x32 load_be(std::span<const uint8_t, 16> in) { return SIMD_4x32::load_be(in.data()); }

void store_le(uint32_t out[4]) const noexcept { this->store_le(reinterpret_cast<uint8_t*>(out)); }

void store_be(uint32_t out[4]) const noexcept { this->store_be(reinterpret_cast<uint8_t*>(out)); }
Expand Down Expand Up @@ -246,6 +252,10 @@ class SIMD_4x32 final {
#endif
}

void store_be(std::span<uint8_t, 16> out) const { this->store_be(out.data()); }

void store_le(std::span<uint8_t, 16> out) const { this->store_le(out.data()); }

/*
* This is used for SHA-2/SHACAL2
*/
Expand Down

0 comments on commit c3d9b40

Please sign in to comment.