by Asooka · 3mo ago · 0 comments
As a sidenote, if implemented as a macro, e.g.
fn fast_sum_f64(values: &[f64]) -> f64 {
let mut total = 0;
fp_opt!(associative, {
for value in values {
total += value;
}
});
return total;
}
A question arises what happens when operating on custom types that overload arithmetic operations. I think the cleanest approach here would be to let the custom type define optimised versions, or have another macro that automatically generates them based on the existing ones, i.e. propagate the optimisation flags.