diff options
author | Andrej Rode <mail@andrejro.de> | 2018-10-16 14:02:04 +0200 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-11-13 16:34:19 -0800 |
commit | bb37f8a8dd4ec47be55611f1dcd79a75fc78fa9b (patch) | |
tree | 780c7f8ef49a0fb90e7a3318a987f64b700d66a5 | |
parent | 7336853c1903ffd8d30d11df7b6a3aa59794c275 (diff) |
runtime: circumvent long long, uint64_t problems on 32-bit archs
C++ bindings for MPIR/GMP don't provide conversion for uint64_t, also
known as "long long" on 32-bit architectures.
Using the underlying (GMP/MPIR) C library directly allows usage of these
types.
-rw-r--r-- | gnuradio-runtime/lib/block.cc | 5 | ||||
-rw-r--r-- | gnuradio-runtime/lib/block_executor.cc | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc index c86e792127..710e6c7d6c 100644 --- a/gnuradio-runtime/lib/block.cc +++ b/gnuradio-runtime/lib/block.cc @@ -194,13 +194,16 @@ namespace gr { void block::set_relative_rate(uint64_t interpolation, uint64_t decimation) { + mpz_class interp, decim; if (interpolation < 1) throw std::invalid_argument("block::set_relative_rate: interpolation rate cannot be 0"); if (decimation < 1) throw std::invalid_argument("block::set_relative_rate: decimation rate cannot be 0"); - d_mp_relative_rate = mpq_class(interpolation, decimation); + mpz_import(interp.get_mpz_t(), 1, 1, sizeof(interpolation), 0, 0, &interpolation); + mpz_import(decim.get_mpz_t(), 1, 1, sizeof(decimation), 0, 0, &decimation); + d_mp_relative_rate = mpq_class(interp, decim); d_mp_relative_rate.canonicalize(); d_relative_rate = d_mp_relative_rate.get_d(); } diff --git a/gnuradio-runtime/lib/block_executor.cc b/gnuradio-runtime/lib/block_executor.cc index 6152ff6765..5f9552415a 100644 --- a/gnuradio-runtime/lib/block_executor.cc +++ b/gnuradio-runtime/lib/block_executor.cc @@ -146,7 +146,8 @@ namespace gr { mpz_class offset; for(t = rtags.begin(); t != rtags.end(); t++) { tag_t new_tag = *t; - offset = new_tag.offset * mp_rrate + one_half; + mpz_import(offset.get_mpz_t(), 1, 1, sizeof(new_tag.offset), 0, 0, &new_tag.offset); + offset *= mp_rrate + one_half; new_tag.offset = offset.get_ui(); for(int o = 0; o < d->noutputs(); o++) out_buf[o]->add_item_tag(new_tag); @@ -188,7 +189,8 @@ namespace gr { mpz_class offset; for(t = rtags.begin(); t != rtags.end(); t++) { tag_t new_tag = *t; - offset = new_tag.offset * mp_rrate + one_half; + mpz_import(offset.get_mpz_t(), 1, 1, sizeof(new_tag.offset), 0, 0, &new_tag.offset); + offset *= mp_rrate + one_half; new_tag.offset = offset.get_ui(); out_buf->add_item_tag(new_tag); } |