Skip to content

Commit 7787bec

Browse files
muladd refactor
1 parent 1f3a179 commit 7787bec

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

include/scalar_node.hh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -731,19 +731,21 @@ inline void _ifelse_::eval<double>(double &res, double a, double b, double c) {
731731
}
732732
UNARY_FN(_log2_, 52, log2);
733733

734-
inline double mul_add(double a, double b, double c) {
735-
return std::fma(a, b, c);
736-
}
737-
using ::mul_add; //+ VCL mul_add
738734

739735
struct _muladd_ : public ScalarNode {
740736
static const char op_code = 53;
741737
static const char n_eval_args = 4;
742738
template <typename VecType>
743-
inline static void eval(VecType& res, VecType a, VecType b, VecType c) {
744-
res = mul_add(a, b, c); // a * b + c
745-
}
739+
inline static void eval(VecType& res, VecType a, VecType b, VecType c);
746740
};
741+
template<typename VecType>
742+
inline void _muladd_::eval(VecType& res, VecType a, VecType b, VecType c) {
743+
res = mul_add(a, b, c); // a * b + c
744+
}
745+
template<>
746+
inline void _muladd_::eval<double>(double& res, double a, double b, double c) {
747+
res = std::fma(a, b, c); // a * b + c
748+
}
747749

748750

749751
/***********************

0 commit comments

Comments
 (0)