Skip to content

Commit db2e390

Browse files
authored
Merge pull request #645 from xtensor-stack/feature/noexcept
Feature/noexcept
2 parents 54aa8e7 + 852614c commit db2e390

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1836
-1836
lines changed

include/xsimd/arch/generic/xsimd_generic_arithmetic.hpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -27,40 +27,40 @@ namespace xsimd
2727

2828
// bitwise_lshift
2929
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value, void>::type*/>
30-
inline batch<T, A> bitwise_lshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>)
30+
inline batch<T, A> bitwise_lshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>) noexcept
3131
{
32-
return detail::apply([](T x, T y)
32+
return detail::apply([](T x, T y) noexcept
3333
{ return x << y; },
3434
self, other);
3535
}
3636

3737
// bitwise_rshift
3838
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value, void>::type*/>
39-
inline batch<T, A> bitwise_rshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>)
39+
inline batch<T, A> bitwise_rshift(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>) noexcept
4040
{
41-
return detail::apply([](T x, T y)
41+
return detail::apply([](T x, T y) noexcept
4242
{ return x >> y; },
4343
self, other);
4444
}
4545

4646
// div
4747
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
48-
inline batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>)
48+
inline batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>) noexcept
4949
{
50-
return detail::apply([](T x, T y) -> T
50+
return detail::apply([](T x, T y) noexcept -> T
5151
{ return x / y; },
5252
self, other);
5353
}
5454

5555
// fma
5656
template <class A, class T>
57-
inline batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>)
57+
inline batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>) noexcept
5858
{
5959
return x * y + z;
6060
}
6161

6262
template <class A, class T>
63-
inline batch<std::complex<T>, A> fma(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>)
63+
inline batch<std::complex<T>, A> fma(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>) noexcept
6464
{
6565
auto res_r = fms(x.real(), y.real(), fms(x.imag(), y.imag(), z.real()));
6666
auto res_i = fma(x.real(), y.imag(), fma(x.imag(), y.real(), z.imag()));
@@ -69,13 +69,13 @@ namespace xsimd
6969

7070
// fms
7171
template <class A, class T>
72-
inline batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>)
72+
inline batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>) noexcept
7373
{
7474
return x * y - z;
7575
}
7676

7777
template <class A, class T>
78-
inline batch<std::complex<T>, A> fms(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>)
78+
inline batch<std::complex<T>, A> fms(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>) noexcept
7979
{
8080
auto res_r = fms(x.real(), y.real(), fma(x.imag(), y.imag(), z.real()));
8181
auto res_i = fma(x.real(), y.imag(), fms(x.imag(), y.real(), z.imag()));
@@ -84,13 +84,13 @@ namespace xsimd
8484

8585
// fnma
8686
template <class A, class T>
87-
inline batch<T, A> fnma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>)
87+
inline batch<T, A> fnma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>) noexcept
8888
{
8989
return -x * y + z;
9090
}
9191

9292
template <class A, class T>
93-
inline batch<std::complex<T>, A> fnma(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>)
93+
inline batch<std::complex<T>, A> fnma(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>) noexcept
9494
{
9595
auto res_r = -fms(x.real(), y.real(), fma(x.imag(), y.imag(), z.real()));
9696
auto res_i = -fma(x.real(), y.imag(), fms(x.imag(), y.real(), z.imag()));
@@ -99,13 +99,13 @@ namespace xsimd
9999

100100
// fnms
101101
template <class A, class T>
102-
inline batch<T, A> fnms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>)
102+
inline batch<T, A> fnms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<generic>) noexcept
103103
{
104104
return -x * y - z;
105105
}
106106

107107
template <class A, class T>
108-
inline batch<std::complex<T>, A> fnms(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>)
108+
inline batch<std::complex<T>, A> fnms(batch<std::complex<T>, A> const& x, batch<std::complex<T>, A> const& y, batch<std::complex<T>, A> const& z, requires_arch<generic>) noexcept
109109
{
110110
auto res_r = -fms(x.real(), y.real(), fms(x.imag(), y.imag(), z.real()));
111111
auto res_i = -fma(x.real(), y.imag(), fma(x.imag(), y.real(), z.imag()));
@@ -114,9 +114,9 @@ namespace xsimd
114114

115115
// mul
116116
template <class A, class T, class /*=typename std::enable_if<std::is_integral<T>::value, void>::type*/>
117-
inline batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>)
117+
inline batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<generic>) noexcept
118118
{
119-
return detail::apply([](T x, T y) -> T
119+
return detail::apply([](T x, T y) noexcept -> T
120120
{ return x * y; },
121121
self, other);
122122
}

include/xsimd/arch/generic/xsimd_generic_complex.hpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -26,54 +26,54 @@ namespace xsimd
2626

2727
// real
2828
template <class A, class T>
29-
inline batch<T, A> real(batch<T, A> const& self, requires_arch<generic>)
29+
inline batch<T, A> real(batch<T, A> const& self, requires_arch<generic>) noexcept
3030
{
3131
return self;
3232
}
3333

3434
template <class A, class T>
35-
inline batch<T, A> real(batch<std::complex<T>, A> const& self, requires_arch<generic>)
35+
inline batch<T, A> real(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
3636
{
3737
return self.real();
3838
}
3939

4040
// imag
4141
template <class A, class T>
42-
inline batch<T, A> imag(batch<T, A> const& /*self*/, requires_arch<generic>)
42+
inline batch<T, A> imag(batch<T, A> const& /*self*/, requires_arch<generic>) noexcept
4343
{
4444
return batch<T, A>(T(0));
4545
}
4646

4747
template <class A, class T>
48-
inline batch<T, A> imag(batch<std::complex<T>, A> const& self, requires_arch<generic>)
48+
inline batch<T, A> imag(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
4949
{
5050
return self.imag();
5151
}
5252

5353
// arg
5454
template <class A, class T>
55-
inline real_batch_type_t<batch<T, A>> arg(batch<T, A> const& self, requires_arch<generic>)
55+
inline real_batch_type_t<batch<T, A>> arg(batch<T, A> const& self, requires_arch<generic>) noexcept
5656
{
5757
return atan2(imag(self), real(self));
5858
}
5959

6060
// conj
6161
template <class A, class T>
62-
inline complex_batch_type_t<batch<T, A>> conj(batch<T, A> const& self, requires_arch<generic>)
62+
inline complex_batch_type_t<batch<T, A>> conj(batch<T, A> const& self, requires_arch<generic>) noexcept
6363
{
6464
return { real(self), -imag(self) };
6565
}
6666

6767
// norm
6868
template <class A, class T>
69-
inline real_batch_type_t<batch<T, A>> norm(batch<T, A> const& self, requires_arch<generic>)
69+
inline real_batch_type_t<batch<T, A>> norm(batch<T, A> const& self, requires_arch<generic>) noexcept
7070
{
7171
return { fma(real(self), real(self), imag(self) * imag(self)) };
7272
}
7373

7474
// proj
7575
template <class A, class T>
76-
inline complex_batch_type_t<batch<T, A>> proj(batch<T, A> const& self, requires_arch<generic>)
76+
inline complex_batch_type_t<batch<T, A>> proj(batch<T, A> const& self, requires_arch<generic>) noexcept
7777
{
7878
using batch_type = complex_batch_type_t<batch<T, A>>;
7979
using real_batch = typename batch_type::real_batch;
@@ -86,7 +86,7 @@ namespace xsimd
8686
}
8787

8888
template <class A, class T>
89-
inline batch_bool<T, A> isnan(batch<std::complex<T>, A> const& self, requires_arch<generic>)
89+
inline batch_bool<T, A> isnan(batch<std::complex<T>, A> const& self, requires_arch<generic>) noexcept
9090
{
9191
return batch_bool<T, A>(isnan(self.real()) || isnan(self.imag()));
9292
}

include/xsimd/arch/generic/xsimd_generic_details.hpp

+40-40
Original file line numberDiff line numberDiff line change
@@ -23,91 +23,91 @@ namespace xsimd
2323
{
2424
// Forward declaration. Should we put them in a separate file?
2525
template <class T, class A>
26-
batch<T, A> abs(batch<T, A> const& self);
26+
inline batch<T, A> abs(batch<T, A> const& self) noexcept;
2727
template <class T, class A>
28-
batch<T, A> abs(batch<std::complex<T>, A> const& self);
28+
inline batch<T, A> abs(batch<std::complex<T>, A> const& self) noexcept;
2929
template <class T, class A>
30-
bool any(batch_bool<T, A> const& self);
30+
inline bool any(batch_bool<T, A> const& self) noexcept;
3131
template <class T, class A>
32-
batch<T, A> atan2(batch<T, A> const& self, batch<T, A> const& other);
32+
inline batch<T, A> atan2(batch<T, A> const& self, batch<T, A> const& other) noexcept;
3333
template <class T, class A>
34-
batch<T, A> bitofsign(batch<T, A> const& self);
34+
inline batch<T, A> bitofsign(batch<T, A> const& self) noexcept;
3535
template <class B, class T, class A>
36-
B bitwise_cast(batch<T, A> const& self);
36+
inline B bitwise_cast(batch<T, A> const& self) noexcept;
3737
template <class A>
38-
batch_bool<float, A> bool_cast(batch_bool<int32_t, A> const& self);
38+
inline batch_bool<float, A> bool_cast(batch_bool<int32_t, A> const& self) noexcept;
3939
template <class A>
40-
batch_bool<int32_t, A> bool_cast(batch_bool<float, A> const& self);
40+
inline batch_bool<int32_t, A> bool_cast(batch_bool<float, A> const& self) noexcept;
4141
template <class A>
42-
batch_bool<double, A> bool_cast(batch_bool<int64_t, A> const& self);
42+
inline batch_bool<double, A> bool_cast(batch_bool<int64_t, A> const& self) noexcept;
4343
template <class A>
44-
batch_bool<int64_t, A> bool_cast(batch_bool<double, A> const& self);
44+
inline batch_bool<int64_t, A> bool_cast(batch_bool<double, A> const& self) noexcept;
4545
template <class T, class A>
46-
batch<T, A> cos(batch<T, A> const& self);
46+
inline batch<T, A> cos(batch<T, A> const& self) noexcept;
4747
template <class T, class A>
48-
batch<T, A> cosh(batch<T, A> const& self);
48+
inline batch<T, A> cosh(batch<T, A> const& self) noexcept;
4949
template <class T, class A>
50-
batch<T, A> exp(batch<T, A> const& self);
50+
inline batch<T, A> exp(batch<T, A> const& self) noexcept;
5151
template <class T, class A>
52-
batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z);
52+
inline batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z) noexcept;
5353
template <class T, class A>
54-
batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z);
54+
inline batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z) noexcept;
5555
template <class T, class A>
56-
batch<T, A> frexp(const batch<T, A>& x, const batch<as_integer_t<T>, A>& e);
56+
inline batch<T, A> frexp(const batch<T, A>& x, const batch<as_integer_t<T>, A>& e) noexcept;
5757
template <class T, class A>
58-
T hadd(batch<T, A> const&);
58+
inline T hadd(batch<T, A> const&) noexcept;
5959
template <class T, class A, uint64_t... Coefs>
60-
batch<T, A> horner(const batch<T, A>& self);
60+
inline batch<T, A> horner(const batch<T, A>& self) noexcept;
6161
template <class T, class A>
62-
batch<T, A> hypot(const batch<T, A>& self);
62+
inline batch<T, A> hypot(const batch<T, A>& self) noexcept;
6363
template <class T, class A>
64-
batch_bool<T, A> is_even(batch<T, A> const& self);
64+
inline batch_bool<T, A> is_even(batch<T, A> const& self) noexcept;
6565
template <class T, class A>
66-
batch_bool<T, A> is_flint(batch<T, A> const& self);
66+
inline batch_bool<T, A> is_flint(batch<T, A> const& self) noexcept;
6767
template <class T, class A>
68-
batch_bool<T, A> is_odd(batch<T, A> const& self);
68+
inline batch_bool<T, A> is_odd(batch<T, A> const& self) noexcept;
6969
template <class T, class A>
70-
batch_bool<T, A> isinf(batch<T, A> const& self);
70+
inline batch_bool<T, A> isinf(batch<T, A> const& self) noexcept;
7171
template <class T, class A>
72-
typename batch<T, A>::batch_bool_type isnan(batch<T, A> const& self);
72+
inline typename batch<T, A>::batch_bool_type isnan(batch<T, A> const& self) noexcept;
7373
template <class T, class A>
74-
batch<T, A> ldexp(const batch<T, A>& x, const batch<as_integer_t<T>, A>& e);
74+
inline batch<T, A> ldexp(const batch<T, A>& x, const batch<as_integer_t<T>, A>& e) noexcept;
7575
template <class T, class A>
76-
batch<T, A> log(batch<T, A> const& self);
76+
inline batch<T, A> log(batch<T, A> const& self) noexcept;
7777
template <class T, class A>
78-
batch<T, A> nearbyint(batch<T, A> const& self);
78+
inline batch<T, A> nearbyint(batch<T, A> const& self) noexcept;
7979
template <class T, class A>
80-
batch<T, A> select(batch_bool<T, A> const&, batch<T, A> const&, batch<T, A> const&);
80+
inline batch<T, A> select(batch_bool<T, A> const&, batch<T, A> const&, batch<T, A> const&) noexcept;
8181
template <class T, class A>
82-
batch<std::complex<T>, A> select(batch_bool<T, A> const&, batch<std::complex<T>, A> const&, batch<std::complex<T>, A> const&);
82+
inline batch<std::complex<T>, A> select(batch_bool<T, A> const&, batch<std::complex<T>, A> const&, batch<std::complex<T>, A> const&) noexcept;
8383
template <class T, class A>
84-
batch<T, A> sign(batch<T, A> const& self);
84+
inline batch<T, A> sign(batch<T, A> const& self) noexcept;
8585
template <class T, class A>
86-
batch<T, A> signnz(batch<T, A> const& self);
86+
inline batch<T, A> signnz(batch<T, A> const& self) noexcept;
8787
template <class T, class A>
88-
batch<T, A> sin(batch<T, A> const& self);
88+
inline batch<T, A> sin(batch<T, A> const& self) noexcept;
8989
template <class T, class A>
90-
batch<T, A> sinh(batch<T, A> const& self);
90+
inline batch<T, A> sinh(batch<T, A> const& self) noexcept;
9191
template <class T, class A>
92-
std::pair<batch<T, A>, batch<T, A>> sincos(batch<T, A> const& self);
92+
inline std::pair<batch<T, A>, batch<T, A>> sincos(batch<T, A> const& self) noexcept;
9393
template <class T, class A>
94-
batch<T, A> sqrt(batch<T, A> const& self);
94+
inline batch<T, A> sqrt(batch<T, A> const& self) noexcept;
9595
template <class T, class A>
96-
batch<T, A> tan(batch<T, A> const& self);
96+
inline batch<T, A> tan(batch<T, A> const& self) noexcept;
9797
template <class T, class A>
98-
batch<as_float_t<T>, A> to_float(batch<T, A> const& self);
98+
inline batch<as_float_t<T>, A> to_float(batch<T, A> const& self) noexcept;
9999
template <class T, class A>
100-
batch<as_integer_t<T>, A> to_int(batch<T, A> const& self);
100+
inline batch<as_integer_t<T>, A> to_int(batch<T, A> const& self) noexcept;
101101
template <class T, class A>
102-
batch<T, A> trunc(batch<T, A> const& self);
102+
inline batch<T, A> trunc(batch<T, A> const& self) noexcept;
103103

104104
namespace kernel
105105
{
106106

107107
namespace detail
108108
{
109109
template <class F, class A, class T, class... Batches>
110-
inline batch<T, A> apply(F&& func, batch<T, A> const& self, batch<T, A> const& other)
110+
inline batch<T, A> apply(F&& func, batch<T, A> const& self, batch<T, A> const& other) noexcept
111111
{
112112
constexpr std::size_t size = batch<T, A>::size;
113113
alignas(A::alignment()) T self_buffer[size];

0 commit comments

Comments
 (0)