From ec9aa207b0e12f04541454c6467bd5c832806c68 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Jul 2019 12:14:39 +0200 Subject: [PATCH 1/4] Do not use bitwise operators with signed operands Use of signed operands with bitwise operators is in some cases subject to undefined or implementation defined behavior. Therefore, bitwise operators should only be used with operands of unsigned integral types. --- .../galileo_telemetry_decoder_gs.cc | 6 ++-- .../gps_l1_ca_telemetry_decoder_gs.cc | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index c6f965a04..bd029d005 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -181,9 +181,9 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_symbol_history.set_capacity(d_required_symbols + 1); // vars for Viterbi decoder - int32_t max_states = 1 << mm; // 2^mm - g_encoder[0] = 121; // Polynomial G1 - g_encoder[1] = 91; // Polynomial G2 + int32_t max_states = 1U << static_cast(mm); // 2^mm + g_encoder[0] = 121; // Polynomial G1 + g_encoder[1] = 91; // Polynomial G2 out0 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); out1 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); state0 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index c7104025c..22a72940e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -145,18 +145,18 @@ bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword) // up bits which are to be XOR'ed together to implement the GPS parity // check algorithm described in IS-GPS-200E. This avoids lengthy shift- // and-xor loops. - d1 = gpsword & 0xFBFFBF00; - d2 = _rotl(gpsword, 1) & 0x07FFBF01; - d3 = _rotl(gpsword, 2) & 0xFC0F8100; - d4 = _rotl(gpsword, 3) & 0xF81FFE02; - d5 = _rotl(gpsword, 4) & 0xFC00000E; - d6 = _rotl(gpsword, 5) & 0x07F00001; - d7 = _rotl(gpsword, 6) & 0x00003000; + d1 = gpsword & 0xFBFFBF00U; + d2 = _rotl(gpsword, 1) & 0x07FFBF01U; + d3 = _rotl(gpsword, 2) & 0xFC0F8100U; + d4 = _rotl(gpsword, 3) & 0xF81FFE02U; + d5 = _rotl(gpsword, 4) & 0xFC00000EU; + d6 = _rotl(gpsword, 5) & 0x07F00001U; + d7 = _rotl(gpsword, 6) & 0x00003000U; t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7; // Now XOR the 5 6-bit fields together to produce the 6-bit final result. - parity = t ^ _rotl(t, 6) ^ _rotl(t, 12) ^ _rotl(t, 18) ^ _rotl(t, 24); - parity = parity & 0x3F; - if (parity == (gpsword & 0x3F)) + parity = t ^ _rotl(t, 6U) ^ _rotl(t, 12U) ^ _rotl(t, 18U) ^ _rotl(t, 24U); + parity = parity & 0x3FU; + if (parity == (gpsword & 0x3FU)) { return true; } @@ -230,19 +230,19 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe() // Bits 0 to 29 = the GPS data word // Bits 30 to 31 = 2 LSBs of the GPS word ahead. // prepare the extended frame [-2 -1 0 ... 30] - if (d_prev_GPS_frame_4bytes & 0x00000001) + if (d_prev_GPS_frame_4bytes & 0x00000001U) { - GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000; + GPS_frame_4bytes = GPS_frame_4bytes | 0x40000000U; } - if (d_prev_GPS_frame_4bytes & 0x00000002) + if (d_prev_GPS_frame_4bytes & 0x00000002U) { - GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000; + GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000U; } // Check that the 2 most recently logged words pass parity. Have to first // invert the data bits according to bit 30 of the previous word. - if (GPS_frame_4bytes & 0x40000000) + if (GPS_frame_4bytes & 0x40000000U) { - GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR) + GPS_frame_4bytes ^= 0x3FFFFFC0U; // invert the data bits (using XOR) } // check parity. If ANY word inside the subframe fails the parity, set subframe_synchro_confirmation = false if (not gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(GPS_frame_4bytes)) @@ -258,7 +258,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe() } else { - GPS_frame_4bytes <<= 1; // shift 1 bit left the telemetry word + GPS_frame_4bytes <<= 1U; // shift 1 bit left the telemetry word } } From 8e0445264a5c29f0ef2fc4c9713348f435f1901f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Jul 2019 12:17:29 +0200 Subject: [PATCH 2/4] Do not use bitwise operators with signed operands Use of signed operands with bitwise operators is in some cases subject to undefined or implementation defined behavior. Therefore, bitwise operators should only be used with operands of unsigned integral types. --- .../gps_l1_ca_telemetry_decoder_gs.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index 22a72940e..3b1542225 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -146,12 +146,12 @@ bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword) // check algorithm described in IS-GPS-200E. This avoids lengthy shift- // and-xor loops. d1 = gpsword & 0xFBFFBF00U; - d2 = _rotl(gpsword, 1) & 0x07FFBF01U; - d3 = _rotl(gpsword, 2) & 0xFC0F8100U; - d4 = _rotl(gpsword, 3) & 0xF81FFE02U; - d5 = _rotl(gpsword, 4) & 0xFC00000EU; - d6 = _rotl(gpsword, 5) & 0x07F00001U; - d7 = _rotl(gpsword, 6) & 0x00003000U; + d2 = _rotl(gpsword, 1U) & 0x07FFBF01U; + d3 = _rotl(gpsword, 2U) & 0xFC0F8100U; + d4 = _rotl(gpsword, 3U) & 0xF81FFE02U; + d5 = _rotl(gpsword, 4U) & 0xFC00000EU; + d6 = _rotl(gpsword, 5U) & 0x07F00001U; + d7 = _rotl(gpsword, 6U) & 0x00003000U; t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7; // Now XOR the 5 6-bit fields together to produce the 6-bit final result. parity = t ^ _rotl(t, 6U) ^ _rotl(t, 12U) ^ _rotl(t, 18U) ^ _rotl(t, 24U); From e7e936f97e78860336263e39b75c4905cbcd33ee Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Jul 2019 15:13:18 +0200 Subject: [PATCH 3/4] Use std::bitset instead of std::array --- .../libs/beidou_b1i_signal_processing.cc | 11 +- .../libs/beidou_b3i_signal_processing.cc | 154 ++++++++++-------- .../libs/gps_sdr_signal_processing.cc | 9 +- 3 files changed, 95 insertions(+), 79 deletions(-) diff --git a/src/algorithms/libs/beidou_b1i_signal_processing.cc b/src/algorithms/libs/beidou_b1i_signal_processing.cc index 7c883607c..504d7ee0d 100644 --- a/src/algorithms/libs/beidou_b1i_signal_processing.cc +++ b/src/algorithms/libs/beidou_b1i_signal_processing.cc @@ -32,17 +32,20 @@ #include "beidou_b1i_signal_processing.h" #include +#include +#include auto auxCeil = [](float x) { return static_cast(static_cast((x) + 1)); }; void beidou_b1i_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 2046; - std::array G1{}; - std::array G2{}; + std::bitset<_code_length> G1{}; + std::bitset<_code_length> G2{}; + + std::bitset<11> G1_register(std::string("01010101010")); + std::bitset<11> G2_register(std::string("01010101010")); - std::array G1_register{false, true, false, true, false, true, false, true, false, true, false}; - std::array G2_register{false, true, false, true, false, true, false, true, false, true, false}; bool feedback1, feedback2; bool aux; uint32_t lcv, lcv2; diff --git a/src/algorithms/libs/beidou_b3i_signal_processing.cc b/src/algorithms/libs/beidou_b3i_signal_processing.cc index a3a1cfbfb..f5e62838a 100644 --- a/src/algorithms/libs/beidou_b3i_signal_processing.cc +++ b/src/algorithms/libs/beidou_b3i_signal_processing.cc @@ -32,85 +32,90 @@ #include "beidou_b3i_signal_processing.h" #include +#include +#include auto auxCeil = [](float x) { return static_cast(static_cast((x) + 1)); }; void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int _chip_shift) { const unsigned int _code_length = 10230; - std::array G1{}; - std::array G2{}; - std::array G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; - std::array G2_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; - std::array G1_register_reset = {{false, false, true, true, true, true, true, true, true, true, true, true, true}}; + std::bitset<_code_length> G1{}; + std::bitset<_code_length> G2{}; + auto G1_register = std::move(std::bitset<13>{}.set()); // All true {true, true, true, true, true, true, true, true, true, true, true, true, true}; + auto G2_register = std::move(std::bitset<13>{}.set()); // All true {true, true, true, true, true, true, true, true, true, true, true, true, true}; + auto G1_register_reset = std::move(std::bitset<13>{}.set()); + G1_register_reset.reset(0); + G1_register_reset.reset(1); // {false, false, true, true, true, true, true, true, true, true, true, true, true}; + bool feedback1, feedback2, aux; uint32_t lcv, lcv2, delay; int32_t prn_idx = _prn - 1; - std::array, 63> G2_register_shifted = - {{{{true, false, true, false, true, true, true, true, true, true, true, true, true}}, - {{true, true, true, true, false, false, false, true, false, true, false, true, true}}, - {{true, false, true, true, true, true, false, false, false, true, false, true, false}}, - {{true, true, true, true, true, true, true, true, true, true, false, true, true}}, - {{true, true, false, false, true, false, false, false, true, true, true, true, true}}, - {{true, false, false, true, false, false, true, true, false, false, true, false, false}}, - {{true, true, true, true, true, true, true, false, true, false, false, true, false}}, - {{true, true, true, false, true, true, true, true, true, true, true, false, true}}, - {{true, false, true, false, false, false, false, false, false, false, false, true, false}}, - {{false, false, true, false, false, false, false, false, true, true, false, true, true}}, - {{true, true, true, false, true, false, true, true, true, false, false, false, false}}, - {{false, false, true, false, true, true, false, false, true, true, true, true, false}}, - {{false, true, true, false, false, true, false, false, true, false, true, false, true}}, - {{false, true, true, true, false, false, false, true, false, false, true, true, false}}, - {{true, false, false, false, true, true, false, false, false, true, false, false, true}}, - {{true, true, true, false, false, false, true, true, true, true, true, false, false}}, - {{false, false, true, false, false, true, true, false, false, false, true, false, true}}, - {{false, false, false, false, false, true, true, true, false, true, true, false, false}}, - {{true, false, false, false, true, false, true, false, true, false, true, true, true}}, - {{false, false, false, true, false, true, true, false, true, true, true, true, false}}, - {{false, false, true, false, false, false, false, true, false, true, true, false, true}}, - {{false, false, true, false, true, true, false, false, false, true, false, true, false}}, - {{false, false, false, true, false, true, true, false, false, true, true, true, true}}, - {{false, false, true, true, false, false, true, true, false, false, false, true, false}}, - {{false, false, true, true, true, false, true, false, false, true, false, false, false}}, - {{false, true, false, false, true, false, false, true, false, true, false, false, true}}, - {{true, false, true, true, false, true, true, false, true, false, false, true, true}}, - {{true, false, true, false, true, true, true, true, false, false, false, true, false}}, - {{false, false, false, true, false, true, true, true, true, false, true, false, true}}, - {{false, true, true, true, true, true, true, true, true, true, true, true, true}}, - {{false, true, true, false, true, true, false, false, false, true, true, true, true}}, - {{true, false, true, false, true, true, false, false, false, true, false, false, true}}, - {{true, false, false, true, false, true, false, true, false, true, false, true, true}}, - {{true, true, false, false, true, true, false, true, false, false, true, false, true}}, - {{true, true, false, true, false, false, true, false, true, true, true, false, true}}, - {{true, true, true, true, true, false, true, true, true, false, true, false, false}}, - {{false, false, true, false, true, false, true, true, false, false, true, true, true}}, - {{true, true, true, false, true, false, false, false, true, false, false, false, false}}, - {{true, true, false, true, true, true, false, false, true, false, false, false, false}}, - {{true, true, false, true, false, true, true, false, false, true, true, true, false}}, - {{true, false, false, false, false, false, false, true, true, false, true, false, false}}, - {{false, true, false, true, true, true, true, false, true, true, false, false, true}}, - {{false, true, true, false, true, true, false, true, true, true, true, false, false}}, - {{true, true, false, true, false, false, true, true, true, false, false, false, true}}, - {{false, false, true, true, true, false, false, true, false, false, false, true, false}}, - {{false, true, false, true, false, true, true, false, false, false, true, false, true}}, - {{true, false, false, true, true, true, true, true, false, false, true, true, false}}, - {{true, true, true, true, true, false, true, false, false, true, false, false, false}}, - {{false, false, false, false, true, false, true, false, false, true, false, false, true}}, - {{true, false, false, false, false, true, false, true, false, true, true, false, false}}, - {{true, true, true, true, false, false, true, false, false, true, true, false, false}}, - {{false, true, false, false, true, true, false, false, false, true, true, true, true}}, - {{false, false, false, false, false, false, false, false, true, true, false, false, false}}, - {{true, false, false, false, false, false, false, false, false, false, true, false, false}}, - {{false, false, true, true, false, true, false, true, false, false, true, true, false}}, - {{true, false, true, true, false, false, true, false, false, false, true, true, false}}, - {{false, true, true, true, false, false, true, true, true, true, false, false, false}}, - {{false, false, true, false, true, true, true, false, false, true, false, true, false}}, - {{true, true, false, false, true, true, true, true, true, false, true, true, false}}, - {{true, false, false, true, false, false, true, false, false, false, true, false, true}}, - {{false, true, true, true, false, false, false, true, false, false, false, false, false}}, - {{false, false, true, true, false, false, true, false, false, false, false, true, false}}, - {{false, false, true, false, false, false, true, false, false, true, true, true, false}}}}; + const std::array, 63> G2_register_shifted = + {std::bitset<13>(std::string("1010111111111")), + std::bitset<13>(std::string("1111000101011")), + std::bitset<13>(std::string("1011110001010")), + std::bitset<13>(std::string("1111111111011")), + std::bitset<13>(std::string("1100100011111")), + std::bitset<13>(std::string("1001001100100")), + std::bitset<13>(std::string("1111111010010")), + std::bitset<13>(std::string("1110111111101")), + std::bitset<13>(std::string("1010000000010")), + std::bitset<13>(std::string("0010000011011")), + std::bitset<13>(std::string("1110101110000")), + std::bitset<13>(std::string("0010110011110")), + std::bitset<13>(std::string("0110010010101")), + std::bitset<13>(std::string("0111000100110")), + std::bitset<13>(std::string("1000110001001")), + std::bitset<13>(std::string("1110001111100")), + std::bitset<13>(std::string("0010011000101")), + std::bitset<13>(std::string("0000011101100")), + std::bitset<13>(std::string("1000101010111")), + std::bitset<13>(std::string("0001011011110")), + std::bitset<13>(std::string("0010000101101")), + std::bitset<13>(std::string("0010110001010")), + std::bitset<13>(std::string("0001011001111")), + std::bitset<13>(std::string("0011001100010")), + std::bitset<13>(std::string("0011101001000")), + std::bitset<13>(std::string("0100100101001")), + std::bitset<13>(std::string("1011011010011")), + std::bitset<13>(std::string("1010111100010")), + std::bitset<13>(std::string("0001011110101")), + std::bitset<13>(std::string("0111111111111")), + std::bitset<13>(std::string("0110110001111")), + std::bitset<13>(std::string("1010110001001")), + std::bitset<13>(std::string("1001010101011")), + std::bitset<13>(std::string("1100110100101")), + std::bitset<13>(std::string("1101001011101")), + std::bitset<13>(std::string("1111101110100")), + std::bitset<13>(std::string("0010101100111")), + std::bitset<13>(std::string("1110100010000")), + std::bitset<13>(std::string("1101110010000")), + std::bitset<13>(std::string("1101011001110")), + std::bitset<13>(std::string("1000000110100")), + std::bitset<13>(std::string("0101111011001")), + std::bitset<13>(std::string("0110110111100")), + std::bitset<13>(std::string("1101001110001")), + std::bitset<13>(std::string("0011100100010")), + std::bitset<13>(std::string("0101011000101")), + std::bitset<13>(std::string("1001111100110")), + std::bitset<13>(std::string("1111101001000")), + std::bitset<13>(std::string("0000101001001")), + std::bitset<13>(std::string("1000010101100")), + std::bitset<13>(std::string("1111001001100")), + std::bitset<13>(std::string("0100110001111")), + std::bitset<13>(std::string("0000000011000")), + std::bitset<13>(std::string("1000000000100")), + std::bitset<13>(std::string("0011010100110")), + std::bitset<13>(std::string("1011001000110")), + std::bitset<13>(std::string("0111001111000")), + std::bitset<13>(std::string("0010111001010")), + std::bitset<13>(std::string("1100111110110")), + std::bitset<13>(std::string("1001001000101")), + std::bitset<13>(std::string("0111000100000")), + std::bitset<13>(std::string("0011001000010")), + std::bitset<13>(std::string("0010001001110"))}; // A simple error check if ((prn_idx < 0) || (prn_idx > 63)) @@ -120,7 +125,14 @@ void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int // Assign shifted G2 register based on prn number G2_register = G2_register_shifted[prn_idx]; - std::reverse(G2_register.begin(), G2_register.end()); + + // std::reverse(G2_register.begin(), G2_register.end()); + for (std::size_t i = 0; i < 6; ++i) + { + bool t = G2_register[i]; + G2_register[i] = G2_register[13 - i - 1]; + G2_register[13 - i - 1] = t; + } // Generate G1 and G2 Register for (lcv = 0; lcv < _code_length; lcv++) @@ -145,7 +157,7 @@ void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int // Reset G1 register if sequence found if (G1_register == G1_register_reset) { - G1_register = {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; + G1_register = std::move(std::bitset<13>{}.set()); // All true {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; } } diff --git a/src/algorithms/libs/gps_sdr_signal_processing.cc b/src/algorithms/libs/gps_sdr_signal_processing.cc index a11ec8bd2..1a4483200 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.cc +++ b/src/algorithms/libs/gps_sdr_signal_processing.cc @@ -32,16 +32,17 @@ #include "gps_sdr_signal_processing.h" #include +#include auto auxCeil = [](float x) { return static_cast(static_cast((x) + 1)); }; void gps_l1_ca_code_gen_int(gsl::span _dest, int32_t _prn, uint32_t _chip_shift) { const uint32_t _code_length = 1023; - std::array G1{}; - std::array G2{}; - std::array G1_register{}; - std::array G2_register{}; + std::bitset<_code_length> G1{}; + std::bitset<_code_length> G2{}; + std::bitset<10> G1_register{}; + std::bitset<10> G2_register{}; bool feedback1, feedback2; bool aux; uint32_t lcv, lcv2; From c36cb0cf4b19938e082f36b5802b13ce8627d356 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 16 Jul 2019 08:53:59 +0200 Subject: [PATCH 4/4] Fix B3I code generation --- .../libs/beidou_b3i_signal_processing.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/algorithms/libs/beidou_b3i_signal_processing.cc b/src/algorithms/libs/beidou_b3i_signal_processing.cc index f5e62838a..e47771d6f 100644 --- a/src/algorithms/libs/beidou_b3i_signal_processing.cc +++ b/src/algorithms/libs/beidou_b3i_signal_processing.cc @@ -42,8 +42,8 @@ void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int const unsigned int _code_length = 10230; std::bitset<_code_length> G1{}; std::bitset<_code_length> G2{}; - auto G1_register = std::move(std::bitset<13>{}.set()); // All true {true, true, true, true, true, true, true, true, true, true, true, true, true}; - auto G2_register = std::move(std::bitset<13>{}.set()); // All true {true, true, true, true, true, true, true, true, true, true, true, true, true}; + auto G1_register = std::move(std::bitset<13>{}.set()); // All true + auto G2_register = std::move(std::bitset<13>{}.set()); // All true auto G1_register_reset = std::move(std::bitset<13>{}.set()); G1_register_reset.reset(0); G1_register_reset.reset(1); // {false, false, true, true, true, true, true, true, true, true, true, true, true}; @@ -126,21 +126,12 @@ void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int // Assign shifted G2 register based on prn number G2_register = G2_register_shifted[prn_idx]; - // std::reverse(G2_register.begin(), G2_register.end()); - for (std::size_t i = 0; i < 6; ++i) - { - bool t = G2_register[i]; - G2_register[i] = G2_register[13 - i - 1]; - G2_register[13 - i - 1] = t; - } - // Generate G1 and G2 Register for (lcv = 0; lcv < _code_length; lcv++) { G1[lcv] = G1_register[0]; G2[lcv] = G2_register[0]; - //feedback1 = (test_G1_register[0]+test_G1_register[2]+test_G1_register[3]+test_G1_register[12]) & 0x1; feedback1 = G1_register[0] xor G1_register[9] xor G1_register[10] xor G1_register[12]; feedback2 = G2_register[0] xor G2_register[1] xor G2_register[3] xor G2_register[4] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[12]; @@ -157,7 +148,7 @@ void beidou_b3i_code_gen_int(gsl::span _dest, signed int _prn, unsigned int // Reset G1 register if sequence found if (G1_register == G1_register_reset) { - G1_register = std::move(std::bitset<13>{}.set()); // All true {{true, true, true, true, true, true, true, true, true, true, true, true, true}}; + G1_register = std::move(std::bitset<13>{}.set()); // All true } }