Skip to content

Commit

Permalink
Improve reusability of average(args...)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlap authored Sep 4, 2023
1 parent f53e249 commit f56aa29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/eve/module/core/regular/impl/average.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ average_(EVE_SUPPORTS(cpu_),
Ts... args) -> common_value_t<T0, Ts...>
{
using r_t = common_value_t<T0, Ts...>;
if constexpr(std::is_floating_point_v<eve::underlying_type_t<r_t>>)
using u_t = underlying_type_t<r_t>;
if constexpr(std::is_floating_point_v<u_t>)
{
using elt_t = element_type_t<r_t>;
elt_t invn = rec(elt_t(sizeof...(args) + 1u));
u_t invn = rec(u_t(sizeof...(args) + 1u));
r_t that(a0 * invn);
auto next = [invn](auto avg, auto x) { return fma(x, invn, avg); };
((that = next(that, args)), ...);
Expand Down

0 comments on commit f56aa29

Please sign in to comment.