[PATCH] Add ubit <-> sbit convertors

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Tue Apr 5 20:51:20 UTC 2016


> On 04 Apr 2016, at 17:49, msuraev at sysmocom.de wrote:
> 
> From: Max <msuraev at sysmocom.de>
> 
> Move functions for conversion between soft and unpacked bits to main
> library as they are generally useful.


Hi!



> +void osmo_ubit2sbit(sbit_t *out, const ubit_t *in, unsigned int num_bits)
> +{
> +	int i;
> +	for (i = 0; i < num_bits; i++)
> +		out[i] = in[i] ? -127 : 127;

> -static void
> -ubit_to_sbit(sbit_t *dst, ubit_t *src, int n)

either keep it with 'int' or at least be consistent. Doesn't the compiler warn here anyway? We don't expect to run on systems where sizeof(int) < sizeof(4) and num_bits > INT_MAX is very unlikely for our domain. Anyway. if you decide to to use unsigned (or size_t) then please be consistent and use it for num_bits and the index variable.

thanks
	holger


More information about the OpenBSC mailing list