Skip to content

Commit

Permalink
Require that SIMD types are trivially copyable
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleš Hrabalík committed Jan 22, 2016
1 parent 2523662 commit 68f3262
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/simdify/impl/named_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ namespace simd {
}

SIMDIFY_INL void swap(named_array& rhs) {
if (std::is_trivial<T>::value) {
if (std::is_trivially_copyable<T>::value) {
std::swap(*this, rhs);
}
else {
Expand Down
3 changes: 3 additions & 0 deletions test/avx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ TEST_CASE("AVX basic guarantees", "[simd_t][x86][avx]") {
REQUIRE(sizeof(F::e_t) * F::W == sizeof(F));
REQUIRE(sizeof(U::e_t) * U::W == sizeof(U));
REQUIRE(sizeof(S::e_t) * S::W == sizeof(S));
REQUIRE((std::is_trivially_copyable<F>::value));
REQUIRE((std::is_trivially_copyable<U>::value));
REQUIRE((std::is_trivially_copyable<S>::value));
}

TEST_CASE("AVX explicit construction", "[simd_t][x86][avx]") {
Expand Down
3 changes: 3 additions & 0 deletions test/dum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ TEST_CASE("DUM basic guarantees", "[simd_t][x86][dum]") {
REQUIRE(sizeof(F::e_t) * F::W == sizeof(F));
REQUIRE(sizeof(U::e_t) * U::W == sizeof(U));
REQUIRE(sizeof(S::e_t) * S::W == sizeof(S));
REQUIRE((std::is_trivially_copyable<F>::value));
REQUIRE((std::is_trivially_copyable<U>::value));
REQUIRE((std::is_trivially_copyable<S>::value));
}

TEST_CASE("DUM explicit construction", "[simd_t][x86][dum]") {
Expand Down
3 changes: 3 additions & 0 deletions test/sse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ TEST_CASE("SSE basic guarantees", "[simd_t][x86][sse]") {
REQUIRE(sizeof(F::e_t) * F::W == sizeof(F));
REQUIRE(sizeof(U::e_t) * U::W == sizeof(U));
REQUIRE(sizeof(S::e_t) * S::W == sizeof(S));
REQUIRE((std::is_trivially_copyable<F>::value));
REQUIRE((std::is_trivially_copyable<U>::value));
REQUIRE((std::is_trivially_copyable<S>::value));
}

TEST_CASE("SSE explicit construction", "[simd_t][x86][sse]") {
Expand Down

0 comments on commit 68f3262

Please sign in to comment.