Skip to content

Commit b74f2b5

Browse files
committed
C++23 compatibility fixes
1 parent f6ca01e commit b74f2b5

3 files changed

Lines changed: 29 additions & 23 deletions

File tree

include/kfr/base/expression.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ template <typename E>
147147
concept expression_argument = input_expression<E> && expression_traits<E>::explicit_operand;
148148

149149
template <typename... E>
150-
concept expression_arguments = ((input_expression<E> && expression_traits<E>::explicit_operand) || ...);
150+
concept expression_arguments = (input_expression<E> && ...) && (expression_argument<E> || ...);
151151

152152
template <typename T>
153153
concept input_output_expression = input_expression<T> && output_expression<T>;

include/kfr/base/simd_expressions.hpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -506,64 +506,64 @@ KFR_INTRINSIC expression_make_function<fn::satsub, E1, E2> satsub(E1&& x, E2&& y
506506
}
507507

508508
template <input_output_expression E1, input_expression E2>
509-
KFR_INTRINSIC E1& operator+=(E1&& e1, E2&& e2)
509+
KFR_INTRINSIC std::remove_reference_t<E1> operator+=(E1&& e1, E2&& e2)
510510
{
511511
process(e1, operator+(e1, e2));
512-
return e1;
512+
return std::forward<E1>(e1);
513513
}
514514
template <input_output_expression E1, input_expression E2>
515-
KFR_INTRINSIC E1& operator-=(E1&& e1, E2&& e2)
515+
KFR_INTRINSIC std::remove_reference_t<E1> operator-=(E1&& e1, E2&& e2)
516516
{
517517
process(e1, operator-(e1, e2));
518-
return e1;
518+
return std::forward<E1>(e1);
519519
}
520520
template <input_output_expression E1, input_expression E2>
521-
KFR_INTRINSIC E1& operator*=(E1&& e1, E2&& e2)
521+
KFR_INTRINSIC std::remove_reference_t<E1> operator*=(E1&& e1, E2&& e2)
522522
{
523523
process(e1, operator*(e1, e2));
524-
return e1;
524+
return std::forward<E1>(e1);
525525
}
526526
template <input_output_expression E1, input_expression E2>
527-
KFR_INTRINSIC E1& operator/=(E1&& e1, E2&& e2)
527+
KFR_INTRINSIC std::remove_reference_t<E1> operator/=(E1&& e1, E2&& e2)
528528
{
529529
process(e1, operator/(e1, e2));
530-
return e1;
530+
return std::forward<E1>(e1);
531531
}
532532
template <input_output_expression E1, input_expression E2>
533-
KFR_INTRINSIC E1& operator%=(E1&& e1, E2&& e2)
533+
KFR_INTRINSIC std::remove_reference_t<E1> operator%=(E1&& e1, E2&& e2)
534534
{
535535
process(e1, operator%(e1, e2));
536-
return e1;
536+
return std::forward<E1>(e1);
537537
}
538538
template <input_output_expression E1, input_expression E2>
539-
KFR_INTRINSIC E1& operator|=(E1&& e1, E2&& e2)
539+
KFR_INTRINSIC std::remove_reference_t<E1> operator|=(E1&& e1, E2&& e2)
540540
{
541541
process(e1, operator|(e1, e2));
542-
return e1;
542+
return std::forward<E1>(e1);
543543
}
544544
template <input_output_expression E1, input_expression E2>
545-
KFR_INTRINSIC E1& operator&=(E1&& e1, E2&& e2)
545+
KFR_INTRINSIC std::remove_reference_t<E1> operator&=(E1&& e1, E2&& e2)
546546
{
547547
process(e1, operator&(e1, e2));
548-
return e1;
548+
return std::forward<E1>(e1);
549549
}
550550
template <input_output_expression E1, input_expression E2>
551-
KFR_INTRINSIC E1& operator^=(E1&& e1, E2&& e2)
551+
KFR_INTRINSIC std::remove_reference_t<E1> operator^=(E1&& e1, E2&& e2)
552552
{
553553
process(e1, operator^(e1, e2));
554-
return e1;
554+
return std::forward<E1>(e1);
555555
}
556556
template <input_output_expression E1, input_expression E2>
557-
KFR_INTRINSIC E1& operator<<=(E1&& e1, E2&& e2)
557+
KFR_INTRINSIC std::remove_reference_t<E1> operator<<=(E1&& e1, E2&& e2)
558558
{
559559
process(e1, operator<<(e1, e2));
560-
return e1;
560+
return std::forward<E1>(e1);
561561
}
562562
template <input_output_expression E1, input_expression E2>
563-
KFR_INTRINSIC E1& operator>>=(E1&& e1, E2&& e2)
563+
KFR_INTRINSIC std::remove_reference_t<E1> operator>>=(E1&& e1, E2&& e2)
564564
{
565565
process(e1, operator>>(e1, e2));
566-
return e1;
566+
return std::forward<E1>(e1);
567567
}
568568

569569
} // namespace KFR_ARCH_NAME

src/dft/ft.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,12 +1517,18 @@ KFR_INTRINSIC void cwrite_transposed(cbool_t<transposed>, complex<T>* ptr, vec<T
15171517
template <size_t I, size_t radix, typename T, size_t N, size_t width = N / 2>
15181518
KFR_INTRINSIC vec<T, N> mul_tw(cbool_t<false>, const vec<T, N>& x, const complex<T>* twiddle)
15191519
{
1520-
return I == 0 ? x : cmul(x, cread<width>(twiddle + width * (I - 1)));
1520+
if constexpr (I == 0)
1521+
return x;
1522+
else
1523+
return cmul(x, cread<width>(twiddle + width * (I - 1)));
15211524
}
15221525
template <size_t I, size_t radix, typename T, size_t N, size_t width = N / 2>
15231526
KFR_INTRINSIC vec<T, N> mul_tw(cbool_t<true>, const vec<T, N>& x, const complex<T>* twiddle)
15241527
{
1525-
return I == 0 ? x : cmul_conj(x, cread<width>(twiddle + width * (I - 1)));
1528+
if constexpr (I == 0)
1529+
return x;
1530+
else
1531+
return cmul_conj(x, cread<width>(twiddle + width * (I - 1)));
15261532
}
15271533

15281534
// Non-final

0 commit comments

Comments
 (0)