mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Fixes for 32 bits architectures
This commit is contained in:
parent
b64850d285
commit
e381f75fd3
@ -364,7 +364,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
else if (d_stat == 1) // check 6 seconds of preamble separation
|
else if (d_stat == 1) // check 6 seconds of preamble separation
|
||||||
{
|
{
|
||||||
preamble_diff_ms = std::round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
preamble_diff_ms = std::round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||||
if (std::abs(preamble_diff_ms - GPS_SUBFRAME_MS) % GPS_SUBFRAME_MS == 0)
|
if (std::abs(preamble_diff_ms - GPS_SUBFRAME_MS) % GPS_SUBFRAME_MS == 0)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
|
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
|
||||||
|
@ -434,7 +434,7 @@ void Galileo_Fnav_Message::decode_page(std::string data)
|
|||||||
|
|
||||||
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||||
{
|
{
|
||||||
uint64_t value = 0;
|
uint64_t value = 0ULL;
|
||||||
int num_of_slices = parameter.size();
|
int num_of_slices = parameter.size();
|
||||||
for (int i = 0; i < num_of_slices; i++)
|
for (int i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
@ -453,57 +453,28 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset<GALILEO_FNAV
|
|||||||
|
|
||||||
int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
int64_t Galileo_Fnav_Message::read_navigation_signed(std::bitset<GALILEO_FNAV_DATA_FRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||||
{
|
{
|
||||||
int64_t value = 0;
|
int64_t value = 0LL;
|
||||||
int num_of_slices = parameter.size();
|
int num_of_slices = parameter.size();
|
||||||
// Discriminate between 64 bits and 32 bits compiler
|
|
||||||
int long_int_size_bytes = sizeof(long int);
|
|
||||||
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
|
|
||||||
{
|
|
||||||
// read the MSB and perform the sign extension
|
|
||||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first] == 1)
|
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < num_of_slices; i++)
|
// read the MSB and perform the sign extension
|
||||||
{
|
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first] == 1)
|
||||||
for (int j = 0; j < parameter[i].second; j++)
|
{
|
||||||
{
|
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
|
||||||
value <<= 1; // shift left
|
|
||||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
|
||||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // we assume we are in a 32 bits system
|
else
|
||||||
{
|
{
|
||||||
// read the MSB and perform the sign extension
|
value &= 0;
|
||||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first] == 1)
|
}
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < num_of_slices; i++)
|
for (int i = 0; i < num_of_slices; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < parameter[i].second; j++)
|
value <<= 1; // shift left
|
||||||
|
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||||
|
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j] == 1)
|
||||||
{
|
{
|
||||||
value <<= 1; // shift left
|
value += 1; // insert the bit
|
||||||
value &= 0xFFFFFFFE; // reset the corresponding bit
|
|
||||||
if (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset<GALILE
|
|||||||
|
|
||||||
uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO_PAGE_TYPE_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||||
{
|
{
|
||||||
uint64_t value = 0;
|
uint64_t value = 0ULL;
|
||||||
int32_t num_of_slices = parameter.size();
|
int32_t num_of_slices = parameter.size();
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
for (int32_t i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
@ -300,57 +300,28 @@ uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset<GALILEO
|
|||||||
|
|
||||||
int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
int64_t Galileo_Navigation_Message::read_navigation_signed(std::bitset<GALILEO_DATA_JK_BITS> bits, const std::vector<std::pair<int32_t, int32_t> > parameter)
|
||||||
{
|
{
|
||||||
int64_t value = 0;
|
int64_t value = 0LL;
|
||||||
int32_t num_of_slices = parameter.size();
|
int32_t num_of_slices = parameter.size();
|
||||||
// Discriminate between 64 bits and 32 bits compiler
|
|
||||||
int32_t long_int_size_bytes = sizeof(long int);
|
|
||||||
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
|
|
||||||
{
|
|
||||||
// read the MSB and perform the sign extension
|
|
||||||
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
|
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
// read the MSB and perform the sign extension
|
||||||
{
|
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
{
|
||||||
{
|
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
||||||
value <<= 1; // shift left
|
|
||||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
|
||||||
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // we assume we are in a 32 bits system
|
else
|
||||||
{
|
{
|
||||||
// read the MSB and perform the sign extension
|
value &= 0;
|
||||||
if (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1)
|
}
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
for (int32_t i = 0; i < num_of_slices; i++)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
value <<= 1; // shift left
|
||||||
|
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||||
|
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
||||||
{
|
{
|
||||||
value <<= 1; // shift left
|
value += 1; // insert the bit
|
||||||
value &= 0xFFFFFFFE; // reset the corresponding bit
|
|
||||||
if (bits[GALILEO_DATA_JK_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset<GPS_CNAV_DATA
|
|||||||
|
|
||||||
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||||
{
|
{
|
||||||
uint64_t value = 0;
|
uint64_t value = 0ULL;
|
||||||
int32_t num_of_slices = parameter.size();
|
int32_t num_of_slices = parameter.size();
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
for (int32_t i = 0; i < num_of_slices; i++)
|
||||||
{
|
{
|
||||||
@ -109,57 +109,28 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_C
|
|||||||
|
|
||||||
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset<GPS_CNAV_DATA_PAGE_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||||
{
|
{
|
||||||
int64_t value = 0;
|
int64_t value = 0LL;
|
||||||
int32_t num_of_slices = parameter.size();
|
int32_t num_of_slices = parameter.size();
|
||||||
// Discriminate between 64 bits and 32 bits compiler
|
|
||||||
int32_t long_int_size_bytes = sizeof(long int);
|
|
||||||
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
|
|
||||||
{
|
|
||||||
// read the MSB and perform the sign extension
|
|
||||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
|
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
// read the MSB and perform the sign extension
|
||||||
{
|
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
{
|
||||||
{
|
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
||||||
value <<= 1; // shift left
|
|
||||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
|
||||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // we assume we are in a 32 bits system
|
else
|
||||||
{
|
{
|
||||||
// read the MSB and perform the sign extension
|
value &= 0;
|
||||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1)
|
}
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
for (int32_t i = 0; i < num_of_slices; i++)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
value <<= 1; // shift left
|
||||||
|
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||||
|
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
|
||||||
{
|
{
|
||||||
value <<= 1; // shift left
|
value += 1; // insert the bit
|
||||||
value &= 0xFFFFFFFE; // reset the corresponding bit
|
|
||||||
if (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,57 +197,28 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset<GPS_SUBFRA
|
|||||||
|
|
||||||
int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
int64_t Gps_Navigation_Message::read_navigation_signed(std::bitset<GPS_SUBFRAME_BITS> bits, const std::vector<std::pair<int32_t, int32_t>> parameter)
|
||||||
{
|
{
|
||||||
int64_t value = 0ULL;
|
int64_t value = 0LL;
|
||||||
int32_t num_of_slices = parameter.size();
|
int32_t num_of_slices = parameter.size();
|
||||||
// Discriminate between 64 bits and 32 bits compiler
|
|
||||||
int32_t long_int_size_bytes = sizeof(long int);
|
|
||||||
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
|
|
||||||
{
|
|
||||||
// read the MSB and perform the sign extension
|
|
||||||
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
|
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
// read the MSB and perform the sign extension
|
||||||
{
|
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
{
|
||||||
{
|
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
|
||||||
value <<= 1; // shift left
|
|
||||||
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
|
||||||
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // we assume we are in a 32 bits system
|
else
|
||||||
{
|
{
|
||||||
// read the MSB and perform the sign extension
|
value &= 0;
|
||||||
if (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1)
|
}
|
||||||
{
|
|
||||||
value ^= 0xFFFFFFFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value &= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < num_of_slices; i++)
|
for (int32_t i = 0; i < num_of_slices; i++)
|
||||||
|
{
|
||||||
|
for (int32_t j = 0; j < parameter[i].second; j++)
|
||||||
{
|
{
|
||||||
for (int32_t j = 0; j < parameter[i].second; j++)
|
value <<= 1; // shift left
|
||||||
|
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
|
||||||
|
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
||||||
{
|
{
|
||||||
value <<= 1; // shift left
|
value += 1; // insert the bit
|
||||||
value &= 0xFFFFFFFE; // reset the corresponding bit
|
|
||||||
if (bits[GPS_SUBFRAME_BITS - parameter[i].first - j] == 1)
|
|
||||||
{
|
|
||||||
value += 1; // insert the bit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user