1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-30 22:56:22 +00:00

Merge branch 'carlesfernandez:next' into osnma-cesare

This commit is contained in:
cesaaargm 2024-01-20 22:05:02 +01:00 committed by GitHub
commit 27a7274e1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 82 additions and 266 deletions

View File

@ -53,7 +53,7 @@ jobs:
rm /usr/local/bin/pydoc3.1* || true rm /usr/local/bin/pydoc3.1* || true
rm /usr/local/bin/python3.1* || true rm /usr/local/bin/python3.1* || true
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew install ninja hdf5 automake armadillo lapack \ brew install ninja hdf5 automake armadillo lapack libmatio \
gflags glog gnuradio log4cpp openssl pugixml protobuf gflags glog gnuradio log4cpp openssl pugixml protobuf
pip3 install mako pip3 install mako
- name: configure - name: configure
@ -82,8 +82,8 @@ jobs:
rm /usr/local/bin/pydoc3.1* || true rm /usr/local/bin/pydoc3.1* || true
rm /usr/local/bin/python3.1* || true rm /usr/local/bin/python3.1* || true
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
brew install ninja pkg-config hdf5 automake armadillo lapack gflags glog \ brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \
gnuradio log4cpp openssl pugixml protobuf gflags glog gnuradio log4cpp openssl pugixml protobuf
pip3 install mako pip3 install mako
- name: configure - name: configure
run: cd build && cmake -GXcode .. run: cd build && cmake -GXcode ..

View File

@ -2061,7 +2061,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
IMPORTED_LOCATION_RELWITHDEBINFO ${ARMADILLO_STATIC_LIBRARY} IMPORTED_LOCATION_RELWITHDEBINFO ${ARMADILLO_STATIC_LIBRARY}
IMPORTED_LOCATION_MINSIZEREL ${ARMADILLO_STATIC_LIBRARY} IMPORTED_LOCATION_MINSIZEREL ${ARMADILLO_STATIC_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" "${LAPACK_LIBRARIES}" ${GFORTRAN} ${ARMADILLO_STATIC_LIBRARY} INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES};${LAPACK_LIBRARIES};${GFORTRAN};${ARMADILLO_STATIC_LIBRARY}"
) )
if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC)
set_target_properties(Armadillo::armadillo PROPERTIES set_target_properties(Armadillo::armadillo PROPERTIES
@ -2069,7 +2069,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
IMPORTED_LOCATION_RELEASE ${binary_dir}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELEASE ${binary_dir}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}
IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" "${LAPACK_LIBRARIES}" ${GFORTRAN} ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES};${LAPACK_LIBRARIES};${GFORTRAN};${binary_dir}/$<$<CONFIG:Debug>:Debug/>$<$<CONFIG:Release>:Release/>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo/>$<$<CONFIG:MinSizeRel>:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}"
) )
endif() endif()
set_package_properties(Armadillo PROPERTIES set_package_properties(Armadillo PROPERTIES

View File

@ -27,6 +27,7 @@ find_library(BLAS_LIBRARIES
/opt/local/lib/lapack /opt/local/lib/lapack
/opt/local/lib/ /opt/local/lib/
/usr/local/opt/lapack/lib /usr/local/opt/lapack/lib
/opt/homebrew/opt/lapack/lib
NO_DEFAULT_PATH NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_ENVIRONMENT_PATH
@ -47,6 +48,7 @@ find_library(LAPACK_LIBRARIES
${BLAS_ROOT_USER_DEFINED}/lapack ${BLAS_ROOT_USER_DEFINED}/lapack
/opt/local/lib/lapack /opt/local/lib/lapack
/usr/local/opt/lapack/lib /usr/local/opt/lapack/lib
/opt/homebrew/opt/lapack/lib
NO_DEFAULT_PATH NO_DEFAULT_PATH
NO_SYSTEM_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_ENVIRONMENT_PATH

View File

@ -44,6 +44,7 @@ if(APPLE)
${GFLAGS_ROOT_USER_PROVIDED}/lib ${GFLAGS_ROOT_USER_PROVIDED}/lib
/usr/local/lib /usr/local/lib
/opt/local/lib /opt/local/lib
/opt/homebrew/opt/gflags/lib
) )
else() else()
find_path(GFlags_ROOT_DIR find_path(GFlags_ROOT_DIR
@ -84,6 +85,7 @@ else()
endif() endif()
if(GFlags_ROOT_DIR) if(GFlags_ROOT_DIR)
unset(GFlags_INCLUDE_DIRS CACHE)
# We are testing only a couple of files in the include directories # We are testing only a couple of files in the include directories
find_path(GFlags_INCLUDE_DIRS find_path(GFlags_INCLUDE_DIRS
gflags/gflags.h gflags/gflags.h
@ -93,6 +95,7 @@ if(GFlags_ROOT_DIR)
/usr/include /usr/include
/usr/local/include /usr/local/include
/opt/local/include /opt/local/include
/opt/homebrew/opt/gflags/include
) )
# Find the libraries # Find the libraries

View File

@ -109,6 +109,7 @@ else()
/usr/include/glog /usr/include/glog
/usr/local/include/glog /usr/local/include/glog
/opt/local/include/glog # default location in Macports /opt/local/include/glog # default location in Macports
/opt/homebrew/opt/glog/include/glog
${GLOG_ROOT}/include/glog ${GLOG_ROOT}/include/glog
) )
endif() endif()

View File

@ -47,6 +47,7 @@ find_path(LIBGTEST_DEV_DIR
/usr/include/gtest /usr/include/gtest
/usr/local/src/googletest/googletest /usr/local/src/googletest/googletest
/opt/local/src/gtest-1.7.0 /opt/local/src/gtest-1.7.0
/opt/homebrew/opt/googletest/include/googletest/googletest
) )
find_path(GTEST_INCLUDE_DIRS find_path(GTEST_INCLUDE_DIRS
@ -57,6 +58,7 @@ find_path(GTEST_INCLUDE_DIRS
/usr/include /usr/include
/usr/local/include /usr/local/include
/opt/local/src/gtest-1.7.0/include /opt/local/src/gtest-1.7.0/include
/opt/homebrew/opt/googletest/include
) )
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -65,12 +65,7 @@ void direct_resampler_conditioner_cb::forecast(int noutput_items,
gr_vector_int &ninput_items_required) gr_vector_int &ninput_items_required)
{ {
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); 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);
unsigned ninputs = ninput_items_required.size(); std::fill(ninput_items_required.begin(), ninput_items_required.end(), nreqd);
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
} }

View File

@ -64,11 +64,7 @@ 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(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1) * sample_freq_in() / sample_freq_out()) + history() - 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);
unsigned ninputs = ninput_items_required.size(); std::fill(ninput_items_required.begin(), ninput_items_required.end(), nreqd);
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
} }

View File

@ -66,12 +66,7 @@ void direct_resampler_conditioner_cs::forecast(int noutput_items,
gr_vector_int &ninput_items_required) gr_vector_int &ninput_items_required)
{ {
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); 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);
unsigned ninputs = ninput_items_required.size(); std::fill(ninput_items_required.begin(), ninput_items_required.end(), nreqd);
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
} }

View File

@ -21,7 +21,7 @@
#include <cmath> // for cos, sin, fmod, sqrt, atan2, fabs, floor #include <cmath> // for cos, sin, fmod, sqrt, atan2, fabs, floor
#include <iostream> // for string, operator<<, cout, ostream #include <iostream> // for string, operator<<, cout, ostream
#include <limits> // for std::numeric_limits #include <limits> // for std::numeric_limits
#include <numeric> // for accumulate
Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message() Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message()
{ {
@ -30,9 +30,6 @@ Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message()
for (uint32_t i = 1; i < 64; i++) for (uint32_t i = 1; i < 64; i++)
{ {
satelliteBlock[i] = gnss_sat.what_block(_system, i); satelliteBlock[i] = gnss_sat.what_block(_system, i);
}
for (uint32_t i = 1; i < 64; i++)
{
almanacHealth[i] = 0; almanacHealth[i] = 0;
} }
} }
@ -48,16 +45,7 @@ bool Beidou_Dnav_Navigation_Message::read_navigation_bool(
const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits, const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits,
const std::vector<std::pair<int32_t, int32_t>>& parameter) const const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
bool value; bool value = bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first];
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first] == 1)
{
value = true;
}
else
{
value = false;
}
return value; return value;
} }
@ -67,16 +55,11 @@ uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned(
const std::vector<std::pair<int32_t, int32_t>>& parameter) const const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& param : parameter)
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 < param.second; j++)
{ {
value <<= 1U; // shift left value = (value << 1U) | static_cast<uint64_t>(bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - param.first - j]);
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
{
value += 1U; // insert the bit
}
} }
} }
return value; return value;
@ -87,29 +70,12 @@ int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed(
const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits, const std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS>& bits,
const std::vector<std::pair<int32_t, int32_t>>& parameter) const const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0; int64_t value = bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first] ? -1LL : 0LL;
const int32_t num_of_slices = parameter.size(); for (const auto& param : parameter)
// read the MSB and perform the sign extension
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first] == 1)
{ {
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable for (int32_t j = 0; j < param.second; j++)
}
else
{ {
value &= 0; value = (value << 1) | static_cast<int64_t>(bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - param.first - j]);
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value *= 2; // shift left the signed integer
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
}
} }
} }
return value; return value;

View File

@ -282,16 +282,12 @@ void Galileo_Fnav_Message::decode_page(const std::string& data)
uint64_t Galileo_Fnav_Message::read_navigation_unsigned(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint64_t Galileo_Fnav_Message::read_navigation_unsigned(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int num_of_slices = parameter.size(); for (const auto& p : parameter)
for (int i = 0; i < num_of_slices; i++)
{ {
for (int j = 0; j < parameter[i].second; j++) for (int j = 0; j < p.second; j++)
{ {
value <<= 1U; // shift left value <<= 1U; // shift left
if (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j]) == 1) value |= static_cast<uint64_t>(bits[GALILEO_FNAV_DATA_FRAME_BITS - p.first - j]);
{
value += 1; // insert the bit
}
} }
} }
return value; return value;
@ -300,29 +296,12 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(const std::bitset<GALILE
int64_t Galileo_Fnav_Message::read_navigation_signed(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const int64_t Galileo_Fnav_Message::read_navigation_signed(const std::bitset<GALILEO_FNAV_DATA_FRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0LL; int64_t value = (bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first] == 1) ? -1LL : 0LL;
const int num_of_slices = parameter.size(); for (const auto& p : parameter)
// read the MSB and perform the sign extension
if (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[0].first]) == 1)
{ {
value ^= 0x0FFFFFFFFFFFFFFF; // 64 bits variable for (int32_t j = 0; j < p.second; j++)
}
else
{ {
value &= 0; value = (value << 1) | static_cast<int64_t>(bits[GALILEO_FNAV_DATA_FRAME_BITS - p.first - j]);
}
for (int i = 0; i < num_of_slices; i++)
{
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 (static_cast<int>(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j]) == 1)
{
value += 1; // insert the bit
}
} }
} }
return value; return value;

View File

@ -74,16 +74,12 @@ bool Galileo_Inav_Message::CRC_test(const std::bitset<GALILEO_DATA_FRAME_BITS>&
uint64_t Galileo_Inav_Message::read_navigation_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint64_t Galileo_Inav_Message::read_navigation_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
for (int32_t i = 0; i < num_of_slices; i++)
{ {
for (int32_t j = 0; j < parameter[i].second; j++) for (int j = 0; j < p.second; j++)
{ {
value <<= 1U; // shift left value <<= 1U; // shift left
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1) value |= static_cast<uint64_t>(bits[GALILEO_DATA_JK_BITS - p.first - j]);
{
value += 1; // insert the bit
}
} }
} }
return value; return value;
@ -93,16 +89,12 @@ uint64_t Galileo_Inav_Message::read_navigation_unsigned(const std::bitset<GALILE
uint8_t Galileo_Inav_Message::read_octet_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint8_t Galileo_Inav_Message::read_octet_unsigned(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint8_t value = 0; uint8_t value = 0;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
for (int32_t i = 0; i < num_of_slices; i++)
{ {
for (int32_t j = 0; j < parameter[i].second; j++) for (int j = 0; j < p.second; j++)
{ {
value <<= 1; // shift left value <<= 1; // shift left
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1) value |= static_cast<uint8_t>(bits[GALILEO_DATA_JK_BITS - p.first - j]);
{
value += 1; // insert the bit
}
} }
} }
return value; return value;
@ -112,16 +104,12 @@ uint8_t Galileo_Inav_Message::read_octet_unsigned(const std::bitset<GALILEO_DATA
uint64_t Galileo_Inav_Message::read_page_type_unsigned(const std::bitset<GALILEO_PAGE_TYPE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint64_t Galileo_Inav_Message::read_page_type_unsigned(const std::bitset<GALILEO_PAGE_TYPE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
for (int32_t i = 0; i < num_of_slices; i++)
{ {
for (int32_t j = 0; j < parameter[i].second; j++) for (int j = 0; j < p.second; j++)
{ {
value <<= 1U; // shift left value <<= 1; // shift left
if (static_cast<int>(bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j]) == 1) value |= static_cast<uint64_t>(bits[GALILEO_PAGE_TYPE_BITS - p.first - j]);
{
value += 1ULL; // insert the bit
}
} }
} }
return value; return value;
@ -130,29 +118,12 @@ uint64_t Galileo_Inav_Message::read_page_type_unsigned(const std::bitset<GALILEO
int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0LL; int64_t value = (bits[GALILEO_DATA_JK_BITS - parameter[0].first] == 1) ? -1LL : 0LL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
// read the MSB and perform the sign extension
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first]) == 1)
{ {
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable for (int32_t j = 0; j < p.second; j++)
}
else
{ {
value &= 0LL; value = (value << 1) | static_cast<int64_t>(bits[GALILEO_DATA_JK_BITS - p.first - j]);
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value *= 2; // shift left the signed integer
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1)
{
value += 1LL; // insert the bit
}
} }
} }
return value; return value;
@ -161,15 +132,7 @@ int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset<GALILEO_D
bool Galileo_Inav_Message::read_navigation_bool(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const bool Galileo_Inav_Message::read_navigation_bool(const std::bitset<GALILEO_DATA_JK_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
bool value; bool value = bits[GALILEO_DATA_JK_BITS - parameter[0].first];
if (static_cast<int>(bits[GALILEO_DATA_JK_BITS - parameter[0].first]) == 1)
{
value = true;
}
else
{
value = false;
}
return value; return value;
} }

View File

@ -156,16 +156,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
bool Glonass_Gnav_Navigation_Message::read_navigation_bool(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const bool Glonass_Gnav_Navigation_Message::read_navigation_bool(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
bool value; bool value = bits[GLONASS_GNAV_STRING_BITS - parameter[0].first];
if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1)
{
value = true;
}
else
{
value = false;
}
return value; return value;
} }
@ -173,16 +164,11 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(const std::bitset<GLO
uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
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 < p.second; j++)
{ {
value <<= 1ULL; // shift left value = (value << 1U) | static_cast<uint64_t>(bits[GLONASS_GNAV_STRING_BITS - p.first - j]);
if (bits[GLONASS_GNAV_STRING_BITS - parameter[i].first - j] == 1)
{
value += 1ULL; // insert the bit
}
} }
} }
return value; return value;
@ -192,26 +178,14 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(const std::bi
int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(const std::bitset<GLONASS_GNAV_STRING_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0LL; int64_t value = 0LL;
int64_t sign = 0LL; int64_t sign = (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1) ? -1LL : 1LL;
const int32_t num_of_slices = parameter.size();
// read the MSB and perform the sign extension // const int32_t num_of_slices = parameter.size();
if (bits[GLONASS_GNAV_STRING_BITS - parameter[0].first] == 1) for (const auto& p : parameter)
{ {
sign = -1LL; for (int32_t j = 1; j < p.second; j++)
}
else
{ {
sign = 1LL; value = (value << 1) + bits[GLONASS_GNAV_STRING_BITS - p.first - j];
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 1; j < parameter[i].second; j++)
{
value <<= 1; // shift left
if (bits[GLONASS_GNAV_STRING_BITS - parameter[i].first - j] == 1)
{
value += 1LL; // insert the bit
}
} }
} }
return (sign * value); return (sign * value);

View File

@ -36,16 +36,7 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message()
bool Gps_CNAV_Navigation_Message::read_navigation_bool(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const bool Gps_CNAV_Navigation_Message::read_navigation_bool(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
bool value; bool value = bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first];
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first]) == 1)
{
value = true;
}
else
{
value = false;
}
return value; return value;
} }
@ -53,16 +44,11 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(const std::bitset<GPS_CNA
uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
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 < p.second; j++)
{ {
value <<= 1ULL; // shift left value = (value << 1) | static_cast<uint64_t>(bits[GPS_CNAV_DATA_PAGE_BITS - p.first - j]);
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j]) == 1)
{
value += 1ULL; // insert the bit
}
} }
} }
return value; return value;
@ -71,29 +57,12 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(const std::bitset
int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(const std::bitset<GPS_CNAV_DATA_PAGE_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0LL; int64_t value = (bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first] == 1) ? -1LL : 0LL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
// read the MSB and perform the sign extension
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[0].first]) == 1)
{ {
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable for (int32_t j = 0; j < p.second; j++)
}
else
{ {
value &= 0LL; value = (value << 1) | static_cast<int64_t>(bits[GPS_CNAV_DATA_PAGE_BITS - p.first - j]);
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value *= 2; // shift left the signed integer
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
if (static_cast<int>(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j]) == 1)
{
value += 1LL; // insert the bit
}
} }
} }
return value; return value;

View File

@ -32,9 +32,6 @@ Gps_Navigation_Message::Gps_Navigation_Message()
for (uint32_t i = 1; i < 33; i++) for (uint32_t i = 1; i < 33; i++)
{ {
satelliteBlock[i] = gnss_sat.what_block(_system, i); satelliteBlock[i] = gnss_sat.what_block(_system, i);
}
for (int32_t i = 1; i < 33; i++)
{
almanacHealth[i] = 0; almanacHealth[i] = 0;
} }
} }
@ -46,66 +43,35 @@ void Gps_Navigation_Message::print_gps_word_bytes(uint32_t GPS_word) const
} }
bool Gps_Navigation_Message::read_navigation_bool(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t> /*unused*/>& parameter) const bool Gps_Navigation_Message::read_navigation_bool(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
bool value; bool value = bits[GPS_SUBFRAME_BITS - parameter[0].first];
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[0].first]) == 1)
{
value = true;
}
else
{
value = false;
}
return value; return value;
} }
uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t> /*unused*/>& parameter) const uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
uint64_t value = 0ULL; uint64_t value = 0ULL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
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 < p.second; ++j)
{ {
value <<= 1; // shift left value = (value << 1) | (bits.test(GPS_SUBFRAME_BITS - p.first - j) ? 1 : 0);
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[i].first - j]) == 1)
{
value += 1ULL; // insert the bit
}
} }
} }
return value; return value;
} }
int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t> /*unused*/>& parameter) const int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset<GPS_SUBFRAME_BITS>& bits, const std::vector<std::pair<int32_t, int32_t>>& parameter) const
{ {
int64_t value = 0LL; int64_t value = (bits[GPS_SUBFRAME_BITS - parameter[0].first] == 1) ? -1LL : 0LL;
const int32_t num_of_slices = parameter.size(); for (const auto& p : parameter)
// read the MSB and perform the sign extension
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[0].first]) == 1)
{ {
value ^= 0xFFFFFFFFFFFFFFFFLL; // 64 bits variable for (int32_t j = 0; j < p.second; j++)
}
else
{ {
value &= 0LL; value = (value << 1) | static_cast<int64_t>(bits[GPS_SUBFRAME_BITS - p.first - j]);
}
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int32_t j = 0; j < parameter[i].second; j++)
{
value *= 2; // shift left the signed integer
value &= 0xFFFFFFFFFFFFFFFELL; // reset the corresponding bit (for the 64 bits variable)
if (static_cast<int>(bits[GPS_SUBFRAME_BITS - parameter[i].first - j]) == 1)
{
value += 1LL; // insert the bit
}
} }
} }
return value; return value;
@ -351,7 +317,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe)
default: default:
break; break;
} // switch subframeID ... } // switch subframeID
return subframe_ID; return subframe_ID;
} }

View File

@ -25,6 +25,11 @@ if(NOT benchmark_FOUND)
"--build" "${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}" "--build" "${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}"
"--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug> "--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
) )
if(CMAKE_GENERATOR STREQUAL Xcode)
set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild"
"-configuration" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
)
endif()
if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode))
set(BENCHMARK_PARALLEL_BUILD "--parallel 2") set(BENCHMARK_PARALLEL_BUILD "--parallel 2")