diff options
author | Josh Blum | 2011-01-17 16:37:45 -0800 |
---|---|---|
committer | Josh Blum | 2011-01-17 16:37:45 -0800 |
commit | 48f9ca90e0cbcbfe67b0e10889c60928d9be5c49 (patch) | |
tree | f6102da8592c252808ab0940063f3b2ad9ef24a4 /gnuradio-core/src/lib/general | |
parent | 31bbbec88b19230eb37b197d7623c3671e57837e (diff) | |
download | gnuradio-48f9ca90e0cbcbfe67b0e10889c60928d9be5c49.tar.gz gnuradio-48f9ca90e0cbcbfe67b0e10889c60928d9be5c49.tar.bz2 gnuradio-48f9ca90e0cbcbfe67b0e10889c60928d9be5c49.zip |
gr math simplification:
Replaces gr_gcd, gr_isnan, and gr_signbit one-time instances with boot math calls.
No point in wrapping these utility math functions into gnuradio when they are
1) provided by boost
2) only called once
Removes gr_math.cc, and configure checks for isnan.
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r-- | gnuradio-core/src/lib/general/Makefile.am | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_math.cc | 102 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_math.h | 13 |
3 files changed, 0 insertions, 116 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 08610c58a..3ceea7a6d 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -100,7 +100,6 @@ libgeneral_la_SOURCES = \ gr_lms_dfe_cc.cc \ gr_lms_dfe_ff.cc \ gr_map_bb.cc \ - gr_math.cc \ gr_misc.cc \ gr_mpsk_receiver_cc.cc \ gr_nlog10_ff.cc \ diff --git a/gnuradio-core/src/lib/general/gr_math.cc b/gnuradio-core/src/lib/general/gr_math.cc deleted file mode 100644 index 82dff469c..000000000 --- a/gnuradio-core/src/lib/general/gr_math.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gr_math.h> -#include <math.h> - -/* - * Greatest Common Divisor, using Euclid's algorithm. - * [There are faster algorithms. See Knuth 4.5.2 if you care] - */ - -long -gr_gcd (long m, long n) -{ - if (m < 0) - m = -m; - - if (n < 0) - n = -n; - - while (n != 0){ - long t = m % n; - m = n; - n = t; - } - - return m; -} - - -/* - * These really need some configure hacking to figure out the right answer. - * As a stop gap, try for a macro, and if not that, then try std:: - */ - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise - -#if defined(isnan) || !defined(CXX_HAS_STD_ISNAN) - -int -gr_isnan (double value) -{ - return isnan (value); -} - -#else - -int -gr_isnan (double value) -{ - return std::isnan (value); -} - -#endif - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -#ifdef signbit - -int -gr_signbit (double x) -{ - return signbit (x); -} - -#else - -int -gr_signbit (double x) -{ - return std::signbit (x); -} - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_math.h b/gnuradio-core/src/lib/general/gr_math.h index ea0f20027..f5935c1da 100644 --- a/gnuradio-core/src/lib/general/gr_math.h +++ b/gnuradio-core/src/lib/general/gr_math.h @@ -35,19 +35,6 @@ gr_is_power_of_2(long x) return x != 0 && (x & (x-1)) == 0; } -long gr_gcd (long m, long n); - -// returns a non-zero value if value is "not-a-number" (NaN), and 0 otherwise -int gr_isnan (double value); - -// returns a non-zero value if the value of x has its sign bit set. -// -// This is not the same as `x < 0.0', because IEEE 754 floating point -// allows zero to be signed. The comparison `-0.0 < 0.0' is false, but -// `gr_signbit (-0.0)' will return a nonzero value. - -int gr_signbit (double x); - /*! * \brief Fast arc tangent using table lookup and linear interpolation * \ingroup misc |