diff options
author | Josh Blum | 2011-02-26 14:49:53 -0800 |
---|---|---|
committer | Josh Blum | 2011-02-27 19:52:51 -0800 |
commit | 239c5860be82936e00cfec16a4e1f06f1a004c59 (patch) | |
tree | 770fb666d27a114a696c5e29e2413e445e64db3c /gnuradio-core/src | |
parent | a02bb131f68d5aa66093310c393562671e389778 (diff) | |
download | gnuradio-239c5860be82936e00cfec16a4e1f06f1a004c59.tar.gz gnuradio-239c5860be82936e00cfec16a4e1f06f1a004c59.tar.bz2 gnuradio-239c5860be82936e00cfec16a4e1f06f1a004c59.zip |
use boost::math::iround in gr_histo_sink_f.cc and gr_wavfile_sink.cc
this provides a round implementation on platforms w/o c99 standard
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/lib/io/gr_histo_sink_f.cc | 5 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_wavfile_sink.cc | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc index a37189c24..fc0c12ce6 100644 --- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc +++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009,2010 Free Software Foundation, Inc. + * Copyright 2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,6 +26,7 @@ #include <gr_histo_sink_f.h> #include <gr_io_signature.h> +#include <boost/math/special_functions/round.hpp> static float get_clean_num(float num){ if (num == 0) return 0; @@ -101,7 +102,7 @@ gr_histo_sink_f::send_frame(void){ int index; float bin_width = (maximum - minimum)/(d_num_bins-1); for (unsigned int i = 0; i < d_sample_count; i++){ - index = round((d_samps[i] - minimum)/bin_width); + index = boost::math::iround((d_samps[i] - minimum)/bin_width); /* ensure the index range in case a small floating point error is involed */ if (index < 0) index = 0; if (index >= (int)d_num_bins) index = d_num_bins-1; diff --git a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc index b60a6e3ab..a96aadc72 100644 --- a/gnuradio-core/src/lib/io/gr_wavfile_sink.cc +++ b/gnuradio-core/src/lib/io/gr_wavfile_sink.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc. + * Copyright 2004,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -33,6 +33,7 @@ #include <cmath> #include <fcntl.h> #include <gruel/thread.h> +#include <boost/math/special_functions/round.hpp> // win32 (mingw/msvc) specific #ifdef HAVE_IO_H @@ -224,7 +225,7 @@ gr_wavfile_sink::convert_to_short(float sample) sample = d_min_sample_val; } - return (short int) roundf(sample); + return (short int) boost::math::iround(sample); } |