mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Changing C-style cast by C++ static_cast
This commit is contained in:
parent
14ddc478a0
commit
df2d8a88aa
@ -60,15 +60,14 @@ direct_resampler_conditioner_cc::direct_resampler_conditioner_cc(
|
|||||||
d_history(1)
|
d_history(1)
|
||||||
{
|
{
|
||||||
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||||
|
const double two_32 = 4294967296.0;
|
||||||
if (d_sample_freq_in >= d_sample_freq_out)
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
{
|
{
|
||||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_out / sample_freq_in));
|
||||||
* sample_freq_out / sample_freq_in);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_in / sample_freq_out));
|
||||||
* sample_freq_in / sample_freq_out);
|
|
||||||
}
|
}
|
||||||
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||||
set_output_multiple(1);
|
set_output_multiple(1);
|
||||||
@ -87,7 +86,7 @@ direct_resampler_conditioner_cc::~direct_resampler_conditioner_cc()
|
|||||||
void direct_resampler_conditioner_cc::forecast(int noutput_items,
|
void direct_resampler_conditioner_cc::forecast(int noutput_items,
|
||||||
gr_vector_int &ninput_items_required)
|
gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
int nreqd = std::max(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1)
|
||||||
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||||
unsigned ninputs = ninput_items_required.size();
|
unsigned ninputs = ninput_items_required.size();
|
||||||
for (unsigned i = 0; i < ninputs; i++)
|
for (unsigned i = 0; i < ninputs; i++)
|
||||||
|
@ -58,17 +58,15 @@ direct_resampler_conditioner_ss::direct_resampler_conditioner_ss(
|
|||||||
d_sample_freq_in(sample_freq_in), d_sample_freq_out(
|
d_sample_freq_in(sample_freq_in), d_sample_freq_out(
|
||||||
sample_freq_out), d_phase(0), d_lphase(0), d_history(1)
|
sample_freq_out), d_phase(0), d_lphase(0), d_history(1)
|
||||||
{
|
{
|
||||||
|
const double two_32 = 4294967296.0;
|
||||||
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
|
||||||
if (d_sample_freq_in >= d_sample_freq_out)
|
if (d_sample_freq_in >= d_sample_freq_out)
|
||||||
{
|
{
|
||||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_out / sample_freq_in));
|
||||||
* sample_freq_out / sample_freq_in);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d_phase_step = (unsigned int)floor((double)4294967296.0
|
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_in / sample_freq_out));
|
||||||
* sample_freq_in / sample_freq_out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
|
||||||
@ -84,7 +82,7 @@ void direct_resampler_conditioner_ss::forecast(int noutput_items,
|
|||||||
gr_vector_int &ninput_items_required)
|
gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nreqd = std::max((unsigned)1, (int)((double)(noutput_items + 1)
|
int nreqd = std::max(static_cast<unsigned>(1), (int)(static_cast<double>(noutput_items + 1)
|
||||||
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
* sample_freq_in() / sample_freq_out()) + history() - 1);
|
||||||
unsigned ninputs = ninput_items_required.size();
|
unsigned ninputs = ninput_items_required.size();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user