diff options
author | Mathias Rasmussen <mathiasvr@gmail.com> | 2019-10-22 22:26:05 +0200 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2019-11-17 18:17:03 -0500 |
commit | c750d104d938cc6f3c09417022f132676f6646e4 (patch) | |
tree | 48eca6126fae23f932ed03f91b672cd685c73582 /gr-fec/lib/puncture_bb_impl.cc | |
parent | f78c95897ec696f208d2bc089c9fdc9e6367903d (diff) |
change rounding method to `lround`
Diffstat (limited to 'gr-fec/lib/puncture_bb_impl.cc')
-rw-r--r-- | gr-fec/lib/puncture_bb_impl.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gr-fec/lib/puncture_bb_impl.cc b/gr-fec/lib/puncture_bb_impl.cc index a365d6a69f..0bfc155184 100644 --- a/gr-fec/lib/puncture_bb_impl.cc +++ b/gr-fec/lib/puncture_bb_impl.cc @@ -79,18 +79,18 @@ puncture_bb_impl::~puncture_bb_impl() {} int puncture_bb_impl::fixed_rate_ninput_to_noutput(int ninput) { - return (int)((((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput) + .5); + return std::lround(((d_puncsize - d_puncholes) / (double)(d_puncsize)) * ninput); } int puncture_bb_impl::fixed_rate_noutput_to_ninput(int noutput) { - return (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput) + .5); + return std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput); } void puncture_bb_impl::forecast(int noutput_items, gr_vector_int& ninput_items_required) { ninput_items_required[0] = - (int)(((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items) + .5); + std::lround((d_puncsize / (double)(d_puncsize - d_puncholes)) * noutput_items); } /* @@ -138,7 +138,7 @@ int puncture_bb_impl::general_work(int noutput_items, % ((int)(((1.0/relative_rate()) * noutput_items) + .5))); */ - consume_each((int)(((1.0 / relative_rate()) * noutput_items) + .5)); + consume_each(std::lround((1.0 / relative_rate()) * noutput_items)); return noutput_items; } |