From 468b74b0a8ca54fdc726bf354dcf4f040ddc3060 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 23 Aug 2017 10:30:57 +0200 Subject: DPD: use std::norm --- src/MemlessPoly.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp index 25a0a23..7da868e 100644 --- a/src/MemlessPoly.cpp +++ b/src/MemlessPoly.cpp @@ -123,15 +123,13 @@ void MemlessPoly::load_coefficients(const std::string &coefFile) /* The restrict keyword is C99, g++ and clang++ however support __restrict * instead, and this allows the compiler to auto-vectorize the loop. */ - static void apply_coeff( const vector &coefs, const complexf *__restrict in, size_t start, size_t stop, complexf *__restrict out) { - for (size_t i = start; i < stop; i+=1) { - - float in_mag_sq = in[i].real() * in[i].real() + in[i].imag() * in[i].imag(); + for (size_t i = start; i < stop; i++) { + const float in_mag_sq = std::norm(in[i]); out[i] = in[i] * ( coefs[0] + in_mag_sq * -- cgit v1.2.3