diff options
author | Jiří Pinkava <j-pi@seznam.cz> | 2015-03-24 02:43:10 +0100 |
---|---|---|
committer | Jiří Pinkava <j-pi@seznam.cz> | 2015-03-29 13:14:24 +0200 |
commit | 5c56ab77b779257bc908e45d7d7e0ff790e9e28d (patch) | |
tree | cd16c2078dfabf5f764c0052513d3740a4c4bd99 /gnuradio-runtime | |
parent | 3dcb5b95a4296ef5f6d61fe75dd06735ac5ea467 (diff) |
do not use deprecated gr_int* types
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r-- | gnuradio-runtime/include/gnuradio/fxpt.h | 19 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/fxpt_vco.h | 2 | ||||
-rw-r--r-- | gnuradio-runtime/lib/math/qa_fxpt.cc | 6 |
3 files changed, 14 insertions, 13 deletions
diff --git a/gnuradio-runtime/include/gnuradio/fxpt.h b/gnuradio-runtime/include/gnuradio/fxpt.h index 6143acafeb..ded32ed36e 100644 --- a/gnuradio-runtime/include/gnuradio/fxpt.h +++ b/gnuradio-runtime/include/gnuradio/fxpt.h @@ -25,6 +25,7 @@ #include <gnuradio/api.h> #include <gnuradio/types.h> +#include <stdint.h> namespace gr { @@ -47,18 +48,18 @@ namespace gr { static const float TWO_TO_THE_31; public: - static gr_int32 + static int32_t float_to_fixed(float x) { // Fold x into -PI to PI. int d = (int)floor(x/2/PI+0.5); x -= d*2*PI; // And convert to an integer. - return (gr_int32) ((float) x * TWO_TO_THE_31 / PI); + return (int32_t) ((float) x * TWO_TO_THE_31 / PI); } static float - fixed_to_float (gr_int32 x) + fixed_to_float (int32_t x) { return x * (PI / TWO_TO_THE_31); } @@ -67,9 +68,9 @@ namespace gr { * \brief Given a fixed point angle x, return float sine (x) */ static float - sin(gr_int32 x) + sin(int32_t x) { - gr_uint32 ux = x; + uint32_t ux = x; int index = ux >> (WORDBITS - NBITS); return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; } @@ -78,9 +79,9 @@ namespace gr { * \brief Given a fixed point angle x, return float cosine (x) */ static float - cos (gr_int32 x) + cos (int32_t x) { - gr_uint32 ux = x + 0x40000000; + uint32_t ux = x + 0x40000000; int index = ux >> (WORDBITS - NBITS); return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1]; } @@ -88,9 +89,9 @@ namespace gr { /* * \brief Given a fixedpoint angle x, return float cos(x) and sin (x) */ - static void sincos(gr_int32 x, float *s, float *c) + static void sincos(int32_t x, float *s, float *c) { - gr_uint32 ux = x; + uint32_t ux = x; int sin_index = ux >> (WORDBITS - NBITS); *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1]; diff --git a/gnuradio-runtime/include/gnuradio/fxpt_vco.h b/gnuradio-runtime/include/gnuradio/fxpt_vco.h index 28560db905..a6bde65f1f 100644 --- a/gnuradio-runtime/include/gnuradio/fxpt_vco.h +++ b/gnuradio-runtime/include/gnuradio/fxpt_vco.h @@ -34,7 +34,7 @@ namespace gr { * \ingroup misc */ class /*GR_RUNTIME_API*/ fxpt_vco { - gr_int32 d_phase; + int32_t d_phase; public: fxpt_vco () : d_phase(0) {} diff --git a/gnuradio-runtime/lib/math/qa_fxpt.cc b/gnuradio-runtime/lib/math/qa_fxpt.cc index d368e7de82..070fb66ccf 100644 --- a/gnuradio-runtime/lib/math/qa_fxpt.cc +++ b/gnuradio-runtime/lib/math/qa_fxpt.cc @@ -51,9 +51,9 @@ qa_fxpt::t0() * sometimes the answer is off by a few bits at the bottom. * Hence, the disabled check. */ - CPPUNIT_ASSERT_EQUAL((gr_int32)0x40000000, gr::fxpt::float_to_fixed(M_PI/2)); - CPPUNIT_ASSERT_EQUAL((gr_int32)0, gr::fxpt::float_to_fixed(0)); - CPPUNIT_ASSERT_EQUAL((gr_int32)0x80000000, gr::fxpt::float_to_fixed(-M_PI)); + CPPUNIT_ASSERT_EQUAL((int32_t)0x40000000, gr::fxpt::float_to_fixed(M_PI/2)); + CPPUNIT_ASSERT_EQUAL((int32_t)0, gr::fxpt::float_to_fixed(0)); + CPPUNIT_ASSERT_EQUAL((int32_t)0x80000000, gr::fxpt::float_to_fixed(-M_PI)); } } |