mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 15:23:04 +00:00 
			
		
		
		
	Replace C-style casts by C++ casts
This commit is contained in:
		| @@ -54,9 +54,9 @@ int byte_x2_to_complex_byte::work(int noutput_items, | ||||
|         gr_vector_const_void_star &input_items, | ||||
|         gr_vector_void_star &output_items) | ||||
| { | ||||
|     const int8_t *in0 = (const int8_t *) input_items[0]; | ||||
|     const int8_t *in1 = (const int8_t *) input_items[1]; | ||||
|     lv_8sc_t *out = (lv_8sc_t *) output_items[0]; | ||||
|     const int8_t *in0 = reinterpret_cast<const int8_t *>(input_items[0]); | ||||
|     const int8_t *in1 = reinterpret_cast<const int8_t *>(input_items[1]); | ||||
|     lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]); | ||||
|     // This could be put into a volk kernel | ||||
|     int8_t real_part; | ||||
|     int8_t imag_part; | ||||
|   | ||||
| @@ -56,8 +56,8 @@ int complex_float_to_complex_byte::work(int noutput_items, | ||||
|         gr_vector_const_void_star &input_items, | ||||
|         gr_vector_void_star &output_items) | ||||
| { | ||||
|     const gr_complex *in = (const gr_complex *) input_items[0]; | ||||
|     lv_8sc_t *out = (lv_8sc_t*) output_items[0]; | ||||
|     const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); | ||||
|     lv_8sc_t *out = reinterpret_cast<lv_8sc_t*>(output_items[0]); | ||||
|     volk_gnsssdr_32fc_convert_8ic(out, in, noutput_items); | ||||
|     return noutput_items; | ||||
| } | ||||
|   | ||||
| @@ -55,9 +55,9 @@ int gnss_sdr_sample_counter::work (int noutput_items, | ||||
|         gr_vector_const_void_star &input_items, | ||||
|         gr_vector_void_star &output_items __attribute__((unused))) | ||||
| { | ||||
|     const Gnss_Synchro *in = (const Gnss_Synchro *)  input_items[0]; // input | ||||
|     const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // input | ||||
|  | ||||
|     double current_T_rx_s = in[noutput_items-1].Tracking_sample_counter / static_cast<double>(in[noutput_items-1].fs); | ||||
|     double current_T_rx_s = in[noutput_items - 1].Tracking_sample_counter / static_cast<double>(in[noutput_items - 1].fs); | ||||
|     if ((current_T_rx_s - last_T_rx_s) > report_interval_s) | ||||
|         { | ||||
|             std::cout << "Current receiver time: " << floor(current_T_rx_s) << " [s]" << std::endl; | ||||
|   | ||||
| @@ -64,7 +64,7 @@ int gnss_sdr_valve::work (int noutput_items, | ||||
|             delete cmf; | ||||
|             return -1;    // Done! | ||||
|         } | ||||
|     unsigned long long n = std::min(d_nitems - d_ncopied_items, (long long unsigned int)noutput_items); | ||||
|     unsigned long long n = std::min(d_nitems - d_ncopied_items, static_cast<long long unsigned int>(noutput_items)); | ||||
|     if (n == 0) return 0; | ||||
|     memcpy (output_items[0], input_items[0], n * input_signature()->sizeof_stream_item(0)); | ||||
|     //for(long long i = 0; i++; i<n) | ||||
|   | ||||
| @@ -48,7 +48,7 @@ void gps_l2c_m_code(int32_t * _dest, unsigned int _prn) | ||||
|     x = GPS_L2C_M_INIT_REG[ _prn - 1]; | ||||
|     for (int n = 0; n < GPS_L2_M_CODE_LENGTH_CHIPS; n++) | ||||
|         { | ||||
|             _dest[n] = (int8_t)(x&1); | ||||
|             _dest[n] = static_cast<int8_t>(x&1); | ||||
|             x = gps_l2c_m_shift(x); | ||||
|         } | ||||
| } | ||||
| @@ -102,7 +102,7 @@ void gps_l2c_m_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int | ||||
|  | ||||
|             //--- Make index array to read L2C code values ------------------------- | ||||
|             //TODO: Check this formula! Seems to start with an extra sample | ||||
|             _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1; | ||||
|             _codeValueIndex = ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1; | ||||
|             //aux = (_ts * (i + 1)) / _tc; | ||||
|             //_codeValueIndex = static_cast<int>(static_cast<long>(aux)) - 1; | ||||
|  | ||||
|   | ||||
| @@ -54,9 +54,9 @@ int short_x2_to_cshort::work(int noutput_items, | ||||
|         gr_vector_const_void_star &input_items, | ||||
|         gr_vector_void_star &output_items) | ||||
| { | ||||
|     const short *in0 = (const short *) input_items[0]; | ||||
|     const short *in1 = (const short *) input_items[1]; | ||||
|     lv_16sc_t *out = (lv_16sc_t *) output_items[0]; | ||||
|     const short *in0 = reinterpret_cast<const short *>(input_items[0]); | ||||
|     const short *in1 = reinterpret_cast<const short *>(input_items[1]); | ||||
|     lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]); | ||||
|     // This could be put into a volk kernel | ||||
|     short real_part; | ||||
|     short imag_part; | ||||
|   | ||||
| @@ -76,7 +76,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, | ||||
|     // 1. Setup lookup table | ||||
|     for (unsigned i = 0; i < 0xff; i++) | ||||
|         { | ||||
|             lookup_[i] = ((float)(i & 0xff) - 127.4f) * (1.0f / 128.0f); | ||||
|             lookup_[i] = (static_cast<float>(i & 0xff) - 127.4f) * (1.0f / 128.0f); | ||||
|         } | ||||
|  | ||||
|     // 2. Set socket options | ||||
|   | ||||
| @@ -123,7 +123,7 @@ bool cpu_multicorrelator::Carrier_wipeoff_multicorrelator_resampler( | ||||
|     lv_32fc_t phase_offset_as_complex[1]; | ||||
|     phase_offset_as_complex[0] = lv_cmake(std::cos(rem_carrier_phase_in_rad), -std::sin(rem_carrier_phase_in_rad)); | ||||
|     // call VOLK_GNSSSDR kernel | ||||
|     volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, - phase_step_rad)), phase_offset_as_complex, (const lv_32fc_t**)d_local_codes_resampled, d_n_correlators, signal_length_samples); | ||||
|     volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, - phase_step_rad)), phase_offset_as_complex, const_cast<const lv_32fc_t**>(d_local_codes_resampled), d_n_correlators, signal_length_samples); | ||||
|     return true; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -102,7 +102,7 @@ bool cpu_multicorrelator_16sc::Carrier_wipeoff_multicorrelator_resampler( | ||||
|     lv_32fc_t phase_offset_as_complex[1]; | ||||
|     phase_offset_as_complex[0] = lv_cmake(std::cos(rem_carrier_phase_in_rad), -std::sin(rem_carrier_phase_in_rad)); | ||||
|     // call VOLK_GNSSSDR kernel | ||||
|     volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, -phase_step_rad)), phase_offset_as_complex, (const lv_16sc_t**)d_local_codes_resampled, d_n_correlators, signal_length_samples); | ||||
|     volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn(d_corr_out, d_sig_in, std::exp(lv_32fc_t(0, -phase_step_rad)), phase_offset_as_complex, const_cast<const lv_16sc_t**>(d_local_codes_resampled), d_n_correlators, signal_length_samples); | ||||
|     return true; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez