@@ -1121,15 +1121,15 @@ namespace xsimd
11211121 XSIMD_INLINE batch<float , A> insert (batch<float , A> const & self, float val, index<I>, requires_arch<avx512f>) noexcept
11221122 {
11231123
1124- int32_t * tmp = reinterpret_cast <int32_t *>(& val);
1125- return _mm512_castsi512_ps (_mm512_mask_set1_epi32 (_mm512_castps_si512 (self), __mmask16 (1 << (I & 15 )), * tmp));
1124+ int32_t tmp = bit_cast <int32_t >( val);
1125+ return _mm512_castsi512_ps (_mm512_mask_set1_epi32 (_mm512_castps_si512 (self), __mmask16 (1 << (I & 15 )), tmp));
11261126 }
11271127
11281128 template <class A , size_t I>
11291129 XSIMD_INLINE batch<double , A> insert (batch<double , A> const & self, double val, index<I>, requires_arch<avx512f>) noexcept
11301130 {
1131- int64_t * tmp = reinterpret_cast <int64_t *>(& val);
1132- return _mm512_castsi512_pd (_mm512_mask_set1_epi64 (_mm512_castpd_si512 (self), __mmask8 (1 << (I & 7 )), * tmp));
1131+ int64_t tmp = bit_cast <int64_t >( val);
1132+ return _mm512_castsi512_pd (_mm512_mask_set1_epi64 (_mm512_castpd_si512 (self), __mmask8 (1 << (I & 7 )), tmp));
11331133 }
11341134 template <class A , class T , size_t I, class = typename std::enable_if<std::is_integral<T>::value, void >::type>
11351135 XSIMD_INLINE batch<T, A> insert (batch<T, A> const & self, T val, index<I> pos, requires_arch<avx512f>) noexcept
0 commit comments