1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Ensuring that the unsigned int is 32-bit wide.

This commit is contained in:
Carles Fernandez 2015-02-04 03:06:42 +01:00
parent 3dcac855b8
commit 8f9466ba57
6 changed files with 19 additions and 17 deletions

View File

@ -37,7 +37,7 @@
#include <iostream>
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include <volk/volk.h>
using google::LogMessage;
@ -61,11 +61,11 @@ direct_resampler_conditioner_cb::direct_resampler_conditioner_cb(
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
if (d_sample_freq_in >= d_sample_freq_out)
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_out / sample_freq_in));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
else
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_in / sample_freq_out));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);

View File

@ -33,6 +33,7 @@
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CB_H
#include <gnuradio/block.h>
#include <volk/volk.h>
class direct_resampler_conditioner_cb;
typedef boost::shared_ptr<direct_resampler_conditioner_cb>
@ -57,9 +58,9 @@ private:
double d_sample_freq_in;
double d_sample_freq_out;
unsigned int d_phase;
unsigned int d_lphase;
unsigned int d_phase_step;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
unsigned int d_history;
direct_resampler_conditioner_cb(double sample_freq_in,

View File

@ -63,11 +63,11 @@ direct_resampler_conditioner_cc::direct_resampler_conditioner_cc(
const double two_32 = 4294967296.0;
if (d_sample_freq_in >= d_sample_freq_out)
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_out / sample_freq_in));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
else
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_in / sample_freq_out));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
set_output_multiple(1);

View File

@ -40,6 +40,7 @@
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CC_H
#include <gnuradio/block.h>
#include <volk/volk.h>
class direct_resampler_conditioner_cc;
typedef boost::shared_ptr<direct_resampler_conditioner_cc> direct_resampler_conditioner_cc_sptr;
@ -60,9 +61,9 @@ private:
double sample_freq_out);
double d_sample_freq_in; //! Specifies the sampling frequency of the input signal
double d_sample_freq_out; //! Specifies the sampling frequency of the output signal
unsigned int d_phase;
unsigned int d_lphase;
unsigned int d_phase_step;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
unsigned int d_history;
direct_resampler_conditioner_cc(double sample_freq_in,
double sample_freq_out);

View File

@ -37,7 +37,6 @@
#include <iostream>
#include <gnuradio/io_signature.h>
#include <glog/logging.h>
#include <volk/volk.h>
using google::LogMessage;
@ -61,11 +60,11 @@ direct_resampler_conditioner_cs::direct_resampler_conditioner_cs(
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
if (d_sample_freq_in >= d_sample_freq_out)
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_out / sample_freq_in));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
else
{
d_phase_step = static_cast<unsigned int>(floor(two_32 * sample_freq_in / sample_freq_out));
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);

View File

@ -33,6 +33,7 @@
#define GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_CS_H
#include <gnuradio/block.h>
#include <volk/volk.h>
class direct_resampler_conditioner_cs;
typedef boost::shared_ptr<direct_resampler_conditioner_cs>
@ -57,9 +58,9 @@ private:
double d_sample_freq_in;
double d_sample_freq_out;
unsigned int d_phase;
unsigned int d_lphase;
unsigned int d_phase_step;
uint32_t d_phase;
uint32_t d_lphase;
uint32_t d_phase_step;
unsigned int d_history;
direct_resampler_conditioner_cs(double sample_freq_in,