mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-14 16:54:08 +00:00
Added fxpt64
This commit is contained in:
@@ -30,9 +30,10 @@ if(ENABLE_CUDA)
|
|||||||
endif(ENABLE_CUDA)
|
endif(ENABLE_CUDA)
|
||||||
|
|
||||||
|
|
||||||
set(TRACKING_LIB_SOURCES
|
set(TRACKING_LIB_SOURCES
|
||||||
correlator.cc
|
correlator.cc
|
||||||
cpu_multicorrelator.cc
|
cpu_multicorrelator.cc
|
||||||
|
fxpt64.cc
|
||||||
lock_detectors.cc
|
lock_detectors.cc
|
||||||
tcp_communication.cc
|
tcp_communication.cc
|
||||||
tcp_packet_data.cc
|
tcp_packet_data.cc
|
||||||
|
50
src/algorithms/tracking/libs/fxpt64.cc
Normal file
50
src/algorithms/tracking/libs/fxpt64.cc
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*!
|
||||||
|
* \file fxpt64.cc
|
||||||
|
* \brief Utility functions for fixed point 64 bit arithmetic
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> Cillian O'Driscoll, 2015. cillian.odriscoll(at)gmail.com
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fxpt64.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
int64_t double_to_fxpt64( double in, unsigned int frac_len )
|
||||||
|
{
|
||||||
|
int64_t out = static_cast< int64_t >( in * std::pow(2.0, frac_len) );
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
double fxpt64_to_double( int64_t in, unsigned int frac_len )
|
||||||
|
{
|
||||||
|
double out = static_cast< double >( in ) * std::pow( 2.0, -static_cast<double>(frac_len) );
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
41
src/algorithms/tracking/libs/fxpt64.h
Normal file
41
src/algorithms/tracking/libs/fxpt64.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*!
|
||||||
|
* \file fxpt64.h
|
||||||
|
* \brief Utility functions for fixed point 64 bit arithmetic
|
||||||
|
* \authors <ul>
|
||||||
|
* <li> Cillian O'Driscoll, 2015. cillian.odriscoll(at)gmail.com
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_FXPT64_H_
|
||||||
|
#define GNSS_SDR_FXPT64_H_
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
int64_t double_to_fxpt64( double in, unsigned int frac_len = 32 );
|
||||||
|
double fxpt64_to_double( int64_t in, unsigned int frac_len = 32 );
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user