vir-simd 0.4.189
Parallelism TS 2 extensions and simd fallback implementation
Loading...
Searching...
No Matches
simd_bit.h
1/* SPDX-License-Identifier: LGPL-3.0-or-later */
2/* Copyright © 2022–2024 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
3 * Matthias Kretz <m.kretz@gsi.de>
4 */
5
6#ifndef VIR_SIMD_BIT_H
7#define VIR_SIMD_BIT_H
8
9#include "simd.h"
10#include "detail.h"
11#include <type_traits>
12
13namespace vir
14{
15 template <typename To, typename From>
16 constexpr
17 std::enable_if_t<std::conjunction_v<std::integral_constant<bool, sizeof(To) == sizeof(From)>,
18 meta::is_simd_or_mask<To>,
19 meta::is_simd_or_mask<From>>, To>
20 simd_bit_cast(const From& x)
21 {
22 if constexpr (std::is_trivially_copyable_v<From> and std::is_trivially_copyable_v<To>)
23 return detail::bit_cast<To>(x);
24#if VIR_GLIBCXX_STDX_SIMD and _GLIBCXX_RELEASE >= 12
25 else
26 return std::experimental::__proposed::simd_bit_cast<To>(x);
27#endif
28 }
29}
30
31#endif // VIR_SIMD_BIT_H
This namespace collects libraries and tools authored by Matthias Kretz.
Definition constexpr_wrapper.h:21