Skip to content

Commit 3d565fc

Browse files
authored
#1144 - real_* based concepts has been removed and replaced as they were redundant
1 parent 389cab6 commit 3d565fc

File tree

790 files changed

+3834
-4016
lines changed

Some content is hidden

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

790 files changed

+3834
-4016
lines changed

Diff for: examples/algorithms/using_existing/case_insensitive_equals.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace ascii
3636
constexpr std::uint8_t alphabet_length = 'z' - 'a';
3737
constexpr std::uint8_t a_A_offset = 'a' - 'A';
3838

39-
return eve::sub[(c - 'a') <= alphabet_length](c, a_A_offset);
39+
return eve::sub[(c - std::uint8_t('a')) <= alphabet_length](c, a_A_offset);
4040
}
4141

4242
} inline constexpr to_upper;
@@ -72,7 +72,7 @@ TTS_CASE("to_upper")
7272
for (std::uint8_t x = 0; x != 128; ++x)
7373
{
7474
std::uint8_t expected = x;
75-
if ('a' <= x && x <= 'z') expected = x - ('a' - 'A');
75+
if (std::uint8_t('a') <= x && x <= std::uint8_t('z')) expected = x - std::uint8_t('a' - 'A');
7676
std::uint8_t actual = ascii::to_upper(eve::wide<std::uint8_t>(x)).get(0);
7777
TTS_EQUAL(expected, actual);
7878
}

Diff for: include/eve/arch/cpu/logical.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ namespace eve
6161
//! Construct from a `bool`
6262
EVE_FORCEINLINE constexpr logical(bool v) noexcept : value_(v ? true_mask : false_mask) {}
6363

64-
//! Construct from a scalar_value
65-
template<scalar_value U>
64+
//! Construct from a plain_scalar_value
65+
template<plain_scalar_value U>
6666
EVE_FORCEINLINE explicit constexpr logical(U const &v) noexcept
6767
: value_((v != 0) ? true_mask : false_mask)
6868
{}
@@ -96,7 +96,7 @@ namespace eve
9696
//==============================================================================================
9797
EVE_FORCEINLINE constexpr logical operator!() const noexcept { return {!value_}; }
9898

99-
template<real_scalar_value U>
99+
template<arithmetic_scalar_value U>
100100
friend EVE_FORCEINLINE logical operator&&(logical const& v, logical<U> const& w) noexcept
101101
{
102102
return logical{v.value() && w.value()};
@@ -112,7 +112,7 @@ namespace eve
112112
return logical{v && w.value()};
113113
}
114114

115-
template<real_scalar_value U>
115+
template<arithmetic_scalar_value U>
116116
friend EVE_FORCEINLINE logical operator||(logical const& v, logical<U> const& w) noexcept
117117
{
118118
return logical{v.value() || w.value()};
@@ -154,14 +154,14 @@ namespace eve
154154
return v.value() == w.value();
155155
}
156156

157-
friend EVE_FORCEINLINE logical operator==(logical const& v, real_scalar_value auto w) noexcept
157+
friend EVE_FORCEINLINE logical operator==(logical const& v, bool w) noexcept
158158
{
159-
return v.value() == !!w;
159+
return v.value() == w;
160160
}
161161

162-
friend EVE_FORCEINLINE logical operator==(real_scalar_value auto v, logical const& w) noexcept
162+
friend EVE_FORCEINLINE logical operator==(bool v, logical const& w) noexcept
163163
{
164-
return w.value() == !!v;
164+
return w.value() == v;
165165
}
166166

167167
template<scalar_value U>
@@ -170,14 +170,14 @@ namespace eve
170170
return v.value() != w.value();
171171
}
172172

173-
friend EVE_FORCEINLINE logical operator!=(logical const& v, real_scalar_value auto w) noexcept
173+
friend EVE_FORCEINLINE logical operator!=(logical const& v, bool w) noexcept
174174
{
175-
return v.value() == !w;
175+
return v.value() != w;
176176
}
177177

178-
friend EVE_FORCEINLINE logical operator!=(real_scalar_value auto v, logical const& w) noexcept
178+
friend EVE_FORCEINLINE logical operator!=(bool v, logical const& w) noexcept
179179
{
180-
return w.value() == !v;
180+
return w.value() != v;
181181
}
182182

183183
friend EVE_FORCEINLINE void swap(logical &lhs, logical &rhs) noexcept

Diff for: include/eve/arch/cpu/wide.hpp

+22-18
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,10 @@ namespace eve
534534

535535
//! @brief Perform the compound addition on all the wide lanes and assign the result
536536
//! to the current one. See also: eve::add
537-
template<real_value V>
538-
friend EVE_FORCEINLINE auto& operator+=(wide& w, V v) noexcept
539-
requires(!kumi::product_type<Type>)
537+
template<value V>
538+
friend EVE_FORCEINLINE auto operator+=(wide& w, V v) noexcept
539+
-> decltype(detail::self_add(w, v))
540+
requires(!kumi::product_type<Type>)
540541
{
541542
return detail::self_add(w, v);
542543
}
@@ -551,24 +552,25 @@ namespace eve
551552

552553
//! @brief Perform the addition between a scalar and all lanes of a eve::wide
553554
//! See also: eve::add
554-
friend EVE_FORCEINLINE auto operator+(real_scalar_value auto s, wide const& v) noexcept
555+
friend EVE_FORCEINLINE auto operator+(plain_scalar_value auto s, wide const& v) noexcept
555556
requires(!kumi::product_type<Type>)
556557
{
557558
return v + wide(s);
558559
}
559560

560561
//! @brief Perform the addition between all lanes of a eve::wide and a scalar
561562
//! See also: eve::add
562-
friend EVE_FORCEINLINE auto operator+(wide const& v, real_scalar_value auto s) noexcept
563+
friend EVE_FORCEINLINE auto operator+(wide const& v, plain_scalar_value auto s) noexcept
563564
requires(!kumi::product_type<Type>)
564565
{
565566
return v + wide(s);
566567
}
567568

568569
//! @brief Perform the compound difference on all the wide lanes and assign
569570
//! the result to the current one. See also: eve::sub
570-
template<real_value V>
571-
friend EVE_FORCEINLINE auto& operator-=(wide& w, V v) noexcept
571+
template<value V>
572+
friend EVE_FORCEINLINE auto operator-=(wide& w, V v) noexcept
573+
-> decltype(detail::self_sub(w, v))
572574
requires(!kumi::product_type<Type>)
573575
{
574576
return detail::self_sub(w, v);
@@ -584,24 +586,25 @@ namespace eve
584586

585587
//! @brief Perform the difference between a scalar and all lanes of a eve::wide
586588
//! See also: eve::sub
587-
friend EVE_FORCEINLINE auto operator-(real_scalar_value auto s, wide const& v) noexcept
589+
friend EVE_FORCEINLINE auto operator-(plain_scalar_value auto s, wide const& v) noexcept
588590
requires(!kumi::product_type<Type>)
589591
{
590592
return wide(s) - v;
591593
}
592594

593595
//! @brief Perform the difference between all lanes of a eve::wide and a scalar
594596
//! See also: eve::sub
595-
friend EVE_FORCEINLINE auto operator-(wide const& v, real_scalar_value auto s) noexcept
597+
friend EVE_FORCEINLINE auto operator-(wide const& v, plain_scalar_value auto s) noexcept
596598
requires(!kumi::product_type<Type>)
597599
{
598600
return v - wide(s);
599601
}
600602

601603
//! @brief Perform the compound product on all the wide lanes and assign
602604
//! the result to the current one. See also: eve::mul
603-
template<real_value V>
604-
friend EVE_FORCEINLINE auto& operator*=(wide& w, V o) noexcept
605+
template<value V>
606+
friend EVE_FORCEINLINE auto operator*=(wide& w, V o) noexcept
607+
-> decltype(detail::self_mul(w, o))
605608
requires(!kumi::product_type<Type>)
606609
{
607610
return detail::self_mul(w, o);
@@ -617,25 +620,26 @@ namespace eve
617620

618621
//! @brief Perform the product between a scalar and all lanes of a eve::wide
619622
//! See also: eve::mul
620-
friend EVE_FORCEINLINE auto operator*(real_scalar_value auto s, wide const& v) noexcept
623+
friend EVE_FORCEINLINE auto operator*(plain_scalar_value auto s, wide const& v) noexcept
621624
requires(!kumi::product_type<Type>)
622625
{
623626
return v * s;
624627
}
625628

626629
//! @brief Perform the product between all lanes of a eve::wide and a scalar
627630
//! See also: eve::mul
628-
friend EVE_FORCEINLINE auto operator*(wide const& v, real_scalar_value auto s) noexcept
629-
requires(!kumi::product_type<Type>)
631+
friend EVE_FORCEINLINE auto operator*(wide const& v, plain_scalar_value auto s) noexcept
632+
requires(!kumi::product_type<Type>)
630633
{
631634
auto that = v;
632635
return that *= s;
633636
}
634637

635638
//! @brief Perform the compound division on all the wide lanes and assign
636639
//! the result to the current one. See also: eve::div
637-
template<real_value V>
638-
friend EVE_FORCEINLINE auto& operator/=(wide& w, V o) noexcept
640+
template<value V>
641+
friend EVE_FORCEINLINE auto operator/=(wide& w, V o) noexcept
642+
-> decltype(detail::self_div(w, o))
639643
requires(!kumi::product_type<Type>)
640644
{
641645
return detail::self_div(w, o);
@@ -651,15 +655,15 @@ namespace eve
651655

652656
//! @brief Perform the division between a scalar and all lanes of a eve::wide
653657
//! See also: eve::div
654-
friend EVE_FORCEINLINE auto operator/(real_scalar_value auto s, wide const& v) noexcept
658+
friend EVE_FORCEINLINE auto operator/(plain_scalar_value auto s, wide const& v) noexcept
655659
requires(!kumi::product_type<Type>)
656660
{
657661
return wide(s) / v;
658662
}
659663

660664
//! @brief Perform the division between all lanes of a eve::wide and a scalar
661665
//! See also: eve::div
662-
friend EVE_FORCEINLINE auto operator/(wide const& v, real_scalar_value auto s) noexcept
666+
friend EVE_FORCEINLINE auto operator/(wide const& v, plain_scalar_value auto s) noexcept
663667
requires(!kumi::product_type<Type>)
664668
{
665669
return v / wide(s);

Diff for: include/eve/concept/scalar.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ concept plain_scalar_value = detail::one_of<T,
3232

3333
namespace detail
3434
{
35-
template<typename T> constexpr bool scalar_tuple()
35+
template<typename T>
36+
constexpr bool scalar_tuple()
3637
{
37-
if constexpr( !kumi::product_type<T> ) return false;
38+
if constexpr(!kumi::product_type<T>) return false;
3839
else
3940
{
40-
return kumi::all_of ( kumi::flatten_all(kumi::as_tuple_t<T> {})
41-
, []<typename M>(M) { return plain_scalar_value<M>; }
42-
);
41+
constexpr auto f = []<typename M>(M) { return std::bool_constant<plain_scalar_value<M>>{}; };
42+
using flt_t = kumi::result::flatten_all_t<kumi::as_tuple_t<T>, decltype(f)>;
43+
return kumi::all_of( flt_t{}, [](bool b) { return b; } );
4344
}
4445
}
4546
}

Diff for: include/eve/concept/value.hpp

+13-21
Original file line numberDiff line numberDiff line change
@@ -83,42 +83,34 @@ namespace eve
8383
template<typename T> concept floating_value = value<T> && std::floating_point<element_type_t<T>>;
8484

8585
//================================================================================================
86-
//! @concept real_value
86+
//! @concept logical_value
8787
//! TODO describe
8888
//!
8989
//! @groupheader{Examples}
90-
//! - `double`
91-
//! - `eve::wide<int, eve::fixed<2>>`
90+
//! - `eve::logical<eve::wide<char>>`
91+
//! - `eve::logical<double>`
9292
//================================================================================================
93-
template<typename T> concept real_value = real_simd_value<T> || real_scalar_value<T>;
93+
template<typename T> concept logical_value = value<T> && is_logical_v<T>;
94+
9495

9596
//================================================================================================
96-
//! @concept floating_real_value
97+
//! @concept ordered_value
9798
//! TODO describe
9899
//!
99100
//! @groupheader{Examples}
100101
//! - `double`
101-
//! - `eve::wide<float, eve::fixed<2>>`
102+
//! - `eve::wide<int, eve::fixed<2>>`
102103
//================================================================================================
103-
template<typename T> concept floating_real_value = real_value<T> && std::floating_point<element_type_t<T>>;
104+
template<typename T> concept ordered_value = value<T> && std::totally_ordered<element_type_t<T>>;
104105

105-
//================================================================================================
106-
//! @concept integral_real_value
106+
//================================================================================================
107+
//! @concept floating_ordered_value
107108
//! TODO describe
108109
//!
109110
//! @groupheader{Examples}
110-
//! - `char`
111-
//! - `eve::wide<long int, eve::fixed<2>>`
111+
//! - `double`
112+
//! - `eve::wide<float, eve::fixed<2>>`
112113
//================================================================================================
113-
template<typename T> concept integral_real_value = real_value<T> && std::integral<element_type_t<T>>;
114+
template<typename T> concept floating_ordered_value = ordered_value<T> && std::floating_point<element_type_t<T>>;
114115

115-
//================================================================================================
116-
//! @concept logical_value
117-
//! TODO describe
118-
//!
119-
//! @groupheader{Examples}
120-
//! - `eve::logical<eve::wide<char>>`
121-
//! - `eve::logical<double>`
122-
//================================================================================================
123-
template<typename T> concept logical_value = value<T> && is_logical_v<T>;
124116
}

Diff for: include/eve/concept/vectorizable.hpp

-36
Original file line numberDiff line numberDiff line change
@@ -130,40 +130,4 @@ namespace eve
130130
//! - `double`
131131
//================================================================================================
132132
template<typename T> concept floating_scalar_value = scalar_value<T> && std::floating_point<T>;
133-
134-
//================================================================================================
135-
//! @concept real_scalar_value
136-
//! @brief Specify that a type represents a scalar value
137-
//!
138-
//! The concept `real_scalar_value<T>` is satisfied if and only if T is scalar_value and real_value
139-
//!
140-
//! @groupheader{Examples}
141-
//! - `float`
142-
//! - `int`
143-
//================================================================================================
144-
template<typename T> concept real_scalar_value = scalar_value<T> && std::is_arithmetic_v<T>;
145-
146-
//================================================================================================
147-
//! @concept floating_real_scalar_value
148-
//! @brief Specify that a type represents a scalar value
149-
//!
150-
//! The concept `floating_real_scalar_value<T>` is satisfied if and only if T is scalar_value and floating_real_value
151-
//!
152-
//! @groupheader{Examples}
153-
//! - `float`
154-
//! - `double`
155-
//================================================================================================
156-
template<typename T> concept floating_real_scalar_value = real_scalar_value<T> && std::floating_point<element_type_t<T>>;
157-
158-
//================================================================================================
159-
//! @concept integral_real_scalar_value
160-
//! @brief Specify that a type represents a scalar value
161-
//!
162-
//! The concept `integral_real_scalar_value<T>` is satisfied if and only if T is scalar_value and integral_real_value
163-
//!
164-
//! @groupheader{Examples}
165-
//! - `int`
166-
//! - `unsigned int`
167-
//================================================================================================
168-
template<typename T> concept integral_real_scalar_value = real_scalar_value<T> && std::integral<element_type_t<T>>;
169133
}

Diff for: include/eve/detail/function/operators.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace eve::detail
8787
//================================================================================================
8888
// infix bitwise operators
8989
//================================================================================================
90-
template<real_value T, real_value U>
90+
template<value T, value U>
9191
EVE_FORCEINLINE auto bit_and_(EVE_SUPPORTS(cpu_), T const &a, U const &b) noexcept
9292
requires bit_compatible_values<T, U>
9393
{
@@ -111,7 +111,7 @@ namespace eve::detail
111111
}
112112
}
113113

114-
template<real_value T, real_value U>
114+
template<value T, value U>
115115
EVE_FORCEINLINE auto bit_or_(EVE_SUPPORTS(cpu_), T const &a, U const &b) noexcept
116116
requires bit_compatible_values<T, U>
117117
{
@@ -135,7 +135,7 @@ namespace eve::detail
135135
}
136136
}
137137

138-
template<real_value T, real_value U>
138+
template<value T, value U>
139139
EVE_FORCEINLINE auto bit_xor_(EVE_SUPPORTS(cpu_), T const &a, U const &b) noexcept
140140
requires bit_compatible_values<T, U>
141141
{

0 commit comments

Comments
 (0)