[PATCH] osmo-pcu[master]: TS alloc: use standard function

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/.

Max gerrit-no-reply at lists.osmocom.org
Fri Sep 8 18:03:21 UTC 2017


Review at  https://gerrit.osmocom.org/3896

TS alloc: use standard function

Use ffs() from standard library instead of template magic.

Change-Id: I2d14ef327b09173d56ee3bca7e3ca85897d381c7
---
M src/gprs_ms.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/pcu_utils.h
3 files changed, 2 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/96/3896/1

diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 33d9cad..3e3a605 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -795,7 +795,7 @@
 
 	/* Assume a multislot class 1 device */
 	/* TODO: For class 2 devices, this could be removed */
-	slots = pcu_lsb(slots);
+	slots = ffs(slots);
 
 	return slots;
 }
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index 57197b2..a68b1ab 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -878,7 +878,7 @@
 				dl_slots & ul_slots, compute_usage_by_num_tbfs,
 				NULL, NULL);
 		if (ts < 0)
-			ul_slots = dl_slots = pcu_lsb(dl_slots & ul_slots);
+			ul_slots = dl_slots = ffs(dl_slots & ul_slots);
 		else
 			ul_slots = dl_slots = (dl_slots & ul_slots) & (1<<ts);
 	}
diff --git a/src/pcu_utils.h b/src/pcu_utils.h
index 3a64a47..b5b6fa1 100644
--- a/src/pcu_utils.h
+++ b/src/pcu_utils.h
@@ -39,9 +39,3 @@
 
 	return count;
 }
-
-template <typename T>
-inline T pcu_lsb(T x)
-{
-	return x & -x;
-}

-- 
To view, visit https://gerrit.osmocom.org/3896
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d14ef327b09173d56ee3bca7e3ca85897d381c7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list