commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 04/08: dtv: use numeric_limits for min/max


From: git
Subject: [Commit-gnuradio] [gnuradio] 04/08: dtv: use numeric_limits for min/max values
Date: Mon, 30 Jan 2017 13:38:40 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit 26a882e5ae12ee26ba9c2788ed27164896993f3d
Author: Bastian Bloessl <address@hidden>
Date:   Sun Jan 29 13:54:20 2017 +0100

    dtv: use numeric_limits for min/max values
---
 gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc 
b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
index 135d622..1a347d3 100644
--- a/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
+++ b/gr-dtv/lib/dvbt/dvbt_ofdm_sym_acquisition_impl.cc
@@ -25,6 +25,7 @@
 #include <gnuradio/io_signature.h>
 #include "dvbt_ofdm_sym_acquisition_impl.h"
 #include <complex>
+#include <limits>
 #include <gnuradio/math.h>
 #include <gnuradio/expj.h>
 #include <volk/volk.h>
@@ -37,8 +38,8 @@ namespace gr {
     {
       d_avg_alpha = alpha;
       d_threshold_factor_rise = threshold_factor_rise;
-      d_avg_max = - (float)INFINITY;
-      d_avg_min =   (float)INFINITY;
+      d_avg_max = std::numeric_limits<float>::min();
+      d_avg_min = std::numeric_limits<float>::max();
 
       return (0);
     }
@@ -54,7 +55,7 @@ namespace gr {
       peak_pos_length = 1; 
       if (datain_length >= d_fft_length) {
         float min = datain[(peak_index + d_fft_length / 2) % d_fft_length];
-        if (d_avg_min == (float)INFINITY) {
+        if (d_avg_min == std::numeric_limits<float>::max()) {
           d_avg_min = min;
         }
         else {
@@ -62,7 +63,7 @@ namespace gr {
         }
       }
 
-      if (d_avg_max == -(float)INFINITY) {
+      if (d_avg_max == std::numeric_limits<float>::min()) {
         // Initialize d_avg_max with the first value. 
         d_avg_max = datain[peak_index];
       }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]