This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Tom Tsou gerrit-no-reply at lists.osmocom.orgTom Tsou has submitted this change and it was merged.
Change subject: sigProcLib: Use explicit NaN check in sinc table generation
......................................................................
sigProcLib: Use explicit NaN check in sinc table generation
Using "x < 0.01" is a crude check for detecting NaN condition, which
occurs in a sinc call when x = 0 due to divide-by-zero. Use stdlib
isnan() call for this purpose. Also, as the table is created only
once during initialization, use double floats for table value
generation.
Change-Id: I3a838fe3139fa977dfe906246020a14451185714
---
M Transceiver52M/sigProcLib.cpp
1 file changed, 3 insertions(+), 9 deletions(-)
Approvals:
Tom Tsou: Looks good to me, approved
Harald Welte: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index c776501..9d1ef49 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -979,16 +979,10 @@
static void generateSincTable()
{
- float x;
-
for (int i = 0; i < TABLESIZE; i++) {
- x = (float) i / TABLESIZE * 8 * M_PI;
- if (fabs(x) < 0.01) {
- sincTable[i] = 1.0f;
- continue;
- }
-
- sincTable[i] = sinf(x) / x;
+ auto x = (double) i / TABLESIZE * 8 * M_PI;
+ auto y = sin(x) / x;
+ sincTable[i] = isnan(y) ? 1.0 : y;
}
}
--
To view, visit https://gerrit.osmocom.org/2942
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3a838fe3139fa977dfe906246020a14451185714
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>