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/gerrit-log@lists.osmocom.org/.
Holger Freyther gerrit-no-reply at lists.osmocom.orgHolger Freyther has submitted this change and it was merged.
Change subject: bitvector: Remove code clone and fallback to C implementation
......................................................................
bitvector: Remove code clone and fallback to C implementation
This routine has been moved from from here to libosmocore and as
part of the C++ -> C the reference got converted to a pointer. We
have a lot of code that calls the method with the reference and
instead of updating the callers, create a short inline wrapper to
call the C routine.
Change-Id: Idd16ce251a42bad4401c2bf3a8fa6af70fb600ff
---
M src/bitvector.cpp
M src/bitvector.h
2 files changed, 7 insertions(+), 18 deletions(-)
Approvals:
Max: Looks good to me, but someone else must approve
Jenkins Builder: Verified
Holger Freyther: Looks good to me, approved
diff --git a/src/bitvector.cpp b/src/bitvector.cpp
index 1028407..dcb3baf 100644
--- a/src/bitvector.cpp
+++ b/src/bitvector.cpp
@@ -101,23 +101,6 @@
}
-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;
-}
-
int bitvec_write_field_lh(struct bitvec *bv, unsigned& write_index,
uint64_t val, unsigned len)
{
diff --git a/src/bitvector.h b/src/bitvector.h
index b14d204..246824d 100644
--- a/src/bitvector.h
+++ b/src/bitvector.h
@@ -38,9 +38,15 @@
unsigned int bitvec_pack(struct bitvec *bv, uint8_t *buffer);
unsigned int bitvec_unpack(struct bitvec *bv, uint8_t *buffer);
uint64_t bitvec_read_field(struct bitvec *bv, unsigned& read_index, unsigned len);
-int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len);
int bitvec_write_field_lh(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len);
+
+static inline int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len)
+{
+ /* Call the libosmocore variant */
+ return ::bitvec_write_field(bv, &write_index, val, len);
+}
+
/*! }@ */
#endif // BITVECTOR_H
--
To view, visit https://gerrit.osmocom.org/534
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idd16ce251a42bad4401c2bf3a8fa6af70fb600ff
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>