summaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/bitvec.h
Commit message (Collapse)AuthorAgeFilesLines
* bitvec: Add bitvec_tailroom_bits() functionHarald Welte2019-02-051-0/+6
| | | | | | | | | This is similar to msgb_tailroom(): It returns the amount of space left at the end of the bit vector (compared to the current cursor). The function returns the number of bits left in the bitvec. Change-Id: I8980a6b6d1973b67a2d9ad411c878d956fb428d1
* bitvec: Add bitvec_bytes_used() functionHarald Welte2019-02-051-0/+9
| | | | | | | This new bitvec API function returns the number of bytes used in a given bit-vector. Change-Id: Id4bd7f7543f5b0f4f6f876e283bd065039c37646
* Fix/Update copyright notices; Add SPDX annotationHarald Welte2017-11-131-1/+1
| | | | | | | | Let's fix some erroneous/accidential references to wrong license, update copyright information where applicable and introduce a SPDX-License-Identifier to all files. Change-Id: I39af26c6aaaf5c926966391f6565fc5936be21af
* Replace bitvec_set_uint() with bitvec_set_u64()Max2017-10-241-0/+2
| | | | | | | | | | | | | | | | | | | Old bitvec_set_uint() uses "unsigned int" as input parameter which length is not guaranteed. It does not allow to specify which bit_value to set and does not check for incorrect length. Overall this makes it harder to re-use and more error-prone. Let's replace it with extended implementation which uses fixed type length parameters and extra checks. The additional parameter allows caller to explicitly indicate the need to use L/H instead of 0/1 for bit vector elements. It's necessary to properly encode some of the messages from 3GPP TS 44.018, for example ยง10.5.2.16 IA Rest Octets. The old function is left for backward compatibility as a tiny wrapper around new function and will be deprecated in follow-up patches. Change-Id: I1b670dacb55fb3063271d045f9faa10fccba10a6 Related: OS#1526
* doxygen: unify use of \file across the boardNeels Hofmeyr2017-06-231-17/+3
| | | | | | | | | | | | | | | | | Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
* doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr2017-06-231-10/+10
| | | | | | | | | | Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
* bitvec: Ensure bitvec.h and bitvec.c agree on function argument typeHarald Welte2017-01-151-1/+1
| | | | | | uint32_t may or may not be unsigned int. Change-Id: I21c96985fcbb72372b6df949301c21f1ebca41f2
* Always include <osmocom/core/talloc.h> and not <talloc.h>Harald Welte2017-01-151-1/+1
| | | | | | In EMBEDDED builds we don't have a system-wide talloc Change-Id: Icc526016bda45b36e584afee8669996752d6d89c
* Add function to get uninterrupted bit runPravin Kumarvel2017-01-061-0/+1
| | | | | | | | | Function bitvec_rl_curbit added to get number of uninterrupted bits run in vector starting from the current bit till max number of bits. Test case is added to check bitvec_rl_curbit. Change-Id: Iae153d3639ea6b891c1fc10d7801a435c9492e26
* Mark input parameter to bitvec_set_bits() as 'const'Harald Welte2016-06-271-1/+1
| | | | | | | The input data is accessed in a read-only manner, so it should be marked with the const qualifier. Change-Id: I0d6b86289fa647594f3da1f1c0e0168685307a37
* Add function to add bits from array to bitvecMax2016-03-171-0/+3
| | | | | | | | | Add function which adds specified number of bits from each element of array to the bit vector prefixing each addition with one and finishing entire sequence with adding 0. This is very common patter for various repetitive data structures described with CSN.1 in 3GPP standards. Corresponding test vectors and doxygen headers are added too.
* Expand bitvec interfaceMax2016-02-181-0/+9
| | | | | Add bit filling, shifting and other functions necessary for bit compression implementation. Add corresponding tests.
* bitvec: Test and fix regression for C++->C conversionHolger Hans Peter Freyther2016-01-301-2/+2
| | | | | | | | | | | | | bitvec_read_field/bitvec_write_field in the PCU used a C++ reference and when porting to C it was decided to pass the parameter by value and this lost the "back propagation" of the new index. Change the parameter to be an in/out parameter and this way do not have a silent semantic break in the osmo-pcu (where we copy the reference in csn.1 by value) and have a true compile failure. Add Max's simple test for bitvec_unhex function leaving the checking of bitvec_read_field and the side effect in the datastructure about the number of bits still open.
* Add bitvec-related functions from Osmo-PCUMax2016-01-261-0/+9
| | | | | | Allocation, pack/unpack, field access and helper routines used extensively by Osmo-PCU. Whenever memory allocation happens, alocator context is passed explicitly by caller.
* bitvec: Fix interface to consistently use unsigned intMax2016-01-221-5/+5
| | | | | | | Use unsigned int for the length throughout the interface. We will never have a a negative length. Sponsored-by: On-Waves ehf
* bitvec: Add get/set byte sequencesJacob Erlbeck2016-01-151-0/+10
| | | | | | | | | | | | | | | The new functions bitvec_get_bytes and bitvec_set_bytes copy byte sequences from bitvecs to uint8_t arrays and vice versa. While the bytes in the bitvecs do not need to be aligned, the uint8_t arrays always are. In case the bytes in the bitvec are aligned, the implementation uses memcpy. Note that the implementation like the other existing functions assume MSB first encoding. [hfreyther: Squash the comment fix into this commit as well] Sponsored-by: On-Waves ehf
* bitvec: Fix typo in the csn1 encoding codeHolger Hans Peter Freyther2014-12-281-1/+1
| | | | | We can curse about CSN.1 and 3GPP but I think we want to call it cursor here.
* include: Switch to #pragma once patternSylvain Munaut2014-06-161-4/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* doc: Fix the Doxygen section endingsSylvain Munaut2012-04-181-1/+1
| | | | Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* some more doxygen work (include the notion of modules)Harald Welte2011-08-171-29/+21
|
* bitvec: add missing stdint.hHarald Welte2011-05-291-0/+1
|
* bitvec: add bitvec_find_first_bit_pos() from gsm/rxlev_stat.cPablo Neira Ayuso2011-03-281-0/+2
| | | | | This patch adds bitvec_find_bit_pos() to bitvec.c where it really belongs to. Before this patch used to be part of gsm/rxlev_stat.c
* include: reorganize headers file to include/osmocom/[gsm|core]Pablo Neira Ayuso2011-03-231-0/+75
This patch moves all GSM-specific definitions to include/osmocom/gsm. Moreover, the headers in include/osmocore/ have been moved to include/osmocom/core. This has been proposed by Harald Welte and Sylvain Munaunt. Tested with `make distcheck'. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>