GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
bits.h
Go to the documentation of this file.
1 /*!
2  * \file bits.h
3  * \brief Utilities for bit manipulation of the libswiftnav library
4  * \author Fergus Noble <fergus@swift-nav.com>
5  *
6  * -----------------------------------------------------------------------------
7  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
8  * This file is part of GNSS-SDR.
9  *
10  * This file was originally borrowed from libswiftnav
11  * <https://github.com/swift-nav/libswiftnav>,
12  * a portable C library implementing GNSS related functions and algorithms,
13  * and then modified by J. Arribas and C. Fernandez
14  *
15  * Copyright (C) 2013, 2016 Swift Navigation Inc.
16  * Contact: Fergus Noble <fergus@swift-nav.com>
17  *
18  * SPDX-License-Identifier: LGPL-3.0-only
19  *
20  */
21 
22 #ifndef GNSS_SDR_BITS_H
23 #define GNSS_SDR_BITS_H
24 
25 #include "swift_common.h"
26 
27 /** \addtogroup Telemetry_Decoder
28  * \{ */
29 /** \addtogroup Telemetry_Decoder_libswiftcnav telemetry_decoder_libswiftcnav
30  * Utilities for CNAV message decoding by Swift Navigation Inc.
31  * \{ */
32 
33 
34 uint8_t parity(uint32_t x);
35 uint32_t getbitu(const uint8_t *buff, uint32_t pos, uint8_t len);
36 int32_t getbits(const uint8_t *buff, uint32_t pos, uint8_t len);
37 void setbitu(uint8_t *buff, uint32_t pos, uint32_t len, uint32_t data);
38 void setbits(uint8_t *buff, uint32_t pos, uint32_t len, int32_t data);
39 void bitcopy(void *dst, uint32_t dst_index,
40  const void *src, uint32_t src_index, uint32_t count);
41 void bitshl(void *buf, uint32_t size, uint32_t shift);
42 uint8_t count_bits_u64(uint64_t v, uint8_t bv);
43 uint8_t count_bits_u32(uint32_t v, uint8_t bv);
44 uint8_t count_bits_u16(uint16_t v, uint8_t bv);
45 uint8_t count_bits_u8(uint8_t v, uint8_t bv);
46 
47 
48 /** \} */
49 /** \} */
50 #endif /* GNSS_SDR_BITS_H_ */
Common definitions used throughout the libswiftnav library.