1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

replacing some C casts by C++ casts

This commit is contained in:
Carles Fernandez 2015-01-31 12:16:46 +01:00
parent c00703b0ae
commit 6984e78b70

View File

@ -153,7 +153,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
if (file.is_open()) if (file.is_open())
{ {
size = file.tellg(); size = file.tellg();
DLOG(INFO) << "Total samples in the file= " << floor((double)size / (double)item_size()); DLOG(INFO) << "Total samples in the file= " << floor(static_cast<double>(size) / static_cast<double>(item_size()));
} }
else else
{ {
@ -161,17 +161,17 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
LOG(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str(); LOG(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str();
} }
std::cout << std::setprecision(16); std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl; std::cout << "Processing file " << filename_ << ", which contains " << static_cast<double>(size) << " [bytes]" << std::endl;
if (size > 0) if (size > 0)
{ {
samples_ = floor((double)size / (double)item_size() - ceil(0.002 * (double)sampling_frequency_)); //process all the samples available in the file excluding at least the last 1 ms samples_ = floor(static_cast<double>(size) / static_cast<double>(item_size()) - ceil(0.002 * static_cast<double>(sampling_frequency_))); //process all the samples available in the file excluding at least the last 1 ms
} }
} }
CHECK(samples_ > 0) << "File does not contain enough samples to process."; CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s; double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); signal_duration_s = static_cast<double>(samples_) * ( 1 / static_cast<double>(sampling_frequency_));
if ((item_type_.compare("gr_complex") != 0) && (IF < 1e6) ) // if IF < BW/2, signal is complex (interleaved) if ((item_type_.compare("gr_complex") != 0) && (IF < 1e6) ) // if IF < BW/2, signal is complex (interleaved)
{ {