diff options
author | Eric <ewild@sysmocom.de> | 2020-08-14 03:11:22 +0200 |
---|---|---|
committer | Eric <ewild@sysmocom.de> | 2020-08-25 01:00:19 +0200 |
commit | 7a52e42ee0676f47e801dd348b478302de5d2e50 (patch) | |
tree | c27f7b8d73124325d0fb92297a157589926c41d3 /Transceiver52M/Resampler.cpp | |
parent | 4080eb76f890ea21bb89b402c0b5b6b1b05b9428 (diff) |
transceiver: optimize code if optimizations are enabled
There is no point in checking basic stuff ten thousand times per second
since the sizes never change, so it's enough to enable the
checks/assertions for unoptimized (debug) builds.
This significantly decreases branch mispredictions.
Change-Id: Iebd9e91b3c7f37f2dc646d3017c45139977e4d15
Diffstat (limited to 'Transceiver52M/Resampler.cpp')
-rw-r--r-- | Transceiver52M/Resampler.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Transceiver52M/Resampler.cpp b/Transceiver52M/Resampler.cpp index 7ba0219..2ca6406 100644 --- a/Transceiver52M/Resampler.cpp +++ b/Transceiver52M/Resampler.cpp @@ -99,6 +99,7 @@ void Resampler::initFilters(float bw) reverse(&part[0], &part[filt_len]); } +#ifndef __OPTIMIZE__ static bool check_vec_len(int in_len, int out_len, int p, int q) { if (in_len % q) { @@ -129,14 +130,15 @@ static bool check_vec_len(int in_len, int out_len, int p, int q) return true; } +#endif int Resampler::rotate(const float *in, size_t in_len, float *out, size_t out_len) { int n, path; - +#ifndef __OPTIMIZE__ if (!check_vec_len(in_len, out_len, p, q)) return -1; - +#endif /* Generate output from precomputed input/output paths */ for (size_t i = 0; i < out_len; i++) { n = in_index[i]; |