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> On 27 Jan 2016, at 18:55, suraev at alumni.ntnu.no wrote: > > From: Max <msuraev at sysmocom.de> > > Fix error creeped in while porting code from cpp refs. > Add test case for code in question. > Expand documentatin to clarify function use. Be more specific here. Which routines were impacted? Sure all calls to bitvec_write_field. Why do you decide to not make this variable an in+out variable and instead need to know how many spaces it advanced? Have you checked the other code that was converted? > +static void test_unhex(char *hex) > +{ > + struct bitvec b; > + uint8_t d[64] = {0}; > + b.data = d; > + b.data_len = sizeof(d); > + b.cur_bit = 0; > + printf("%d -=>\n", bitvec_unhex(&b, hex)); > + printf("%s\n%s\n", osmo_hexdump_nospc(d, 64), osmo_hexdump_nospc(hex, 23)); Extend the test to see what happens if you unhex more than d can hold? Instead of dumping up to 64bytes can you see how many bytes are filled? int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len) { unsigned int i; int rc; bv->cur_bit = write_index; for (i = 0; i < len; i++) { int bit = 0; if (val & ((uint64_t)1 << (len - i - 1))) bit = 1; rc = bitvec_set_bit(bv, (bit_value)bit); if (rc) return rc; } write_index += len; return 0; } so if you take the "unsigned&" and make it a plain variable then the write_index += len at the end mkes no sense and can be removed?