Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:36:57

0001 /***************************************************************************
0002  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0003  * Martin Renou                                                             *
0004  * Copyright (c) QuantStack                                                 *
0005  * Copyright (c) Serge Guelton                                              *
0006  *                                                                          *
0007  * Distributed under the terms of the BSD 3-Clause License.                 *
0008  *                                                                          *
0009  * The full license is in the file LICENSE, distributed with this software. *
0010  ****************************************************************************/
0011 
0012 #ifndef XSIMD_COMMON_CAST_HPP
0013 #define XSIMD_COMMON_CAST_HPP
0014 
0015 #include "../../config/xsimd_macros.hpp"
0016 #include "../../utils/xsimd_type_traits.hpp"
0017 
0018 #include <array>
0019 
0020 namespace xsimd
0021 {
0022     namespace kernel
0023     {
0024         template <class A, class T>
0025         XSIMD_INLINE std::array<batch<widen_t<T>, A>, 2> widen(batch<T, A> const& x, requires_arch<common>) noexcept
0026         {
0027             alignas(A::alignment()) T buffer[batch<T, A>::size];
0028             x.store_aligned(&buffer[0]);
0029 
0030             using T_out = widen_t<T>;
0031             alignas(A::alignment()) T_out out_buffer[batch<T, A>::size];
0032             for (size_t i = 0; i < batch<T, A>::size; ++i)
0033                 out_buffer[i] = static_cast<T_out>(buffer[i]);
0034 
0035             return { batch<T_out, A>::load_aligned(&out_buffer[0]),
0036                      batch<T_out, A>::load_aligned(&out_buffer[batch<T_out, A>::size]) };
0037         }
0038 
0039     }
0040 
0041 }
0042 
0043 #endif