[PATCH] osmo-bts[master]: Remove duplicated nibble shift code

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 Jun 24 08:49:27 UTC 2016


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

Remove duplicated nibble shift code

Those functions are now part of libosmocore.

Change-Id: Iab3206e3b41caff23f656a727605032df9798953
---
M src/osmo-bts-litecell15/tch.c
M src/osmo-bts-octphy/l1_tch.c
M src/osmo-bts-sysmo/tch.c
3 files changed, 0 insertions(+), 117 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/10/410/1

diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index b061fe9..187f688 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -55,45 +55,6 @@
 #include "lc15bts.h"
 #include "l1_if.h"
 
-/* input octet-aligned, output not octet-aligned */
-void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in,
-			     unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	/* first byte: upper nibble empty, lower nibble from src */
-	out[0] = (in[0] >> 4);
-
-	/* bytes 1.. */
-	for (i = 1; i < num_whole_bytes; i++)
-		out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4);
-	else
-		out[i] = (in[i-1] & 0xF) << 4;
-}
-
-
-/* input unaligned, output octet-aligned */
-void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in,
-				unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	for (i = 0; i < num_whole_bytes; i++)
-		out[i] = ((in[i] & 0xF) << 4) | (in[i+1] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = (in[i] & 0xF) << 4;
-}
-
 static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len,
 					struct gsm_lchan *lchan)
 {
diff --git a/src/osmo-bts-octphy/l1_tch.c b/src/osmo-bts-octphy/l1_tch.c
index af78980..d12a1cb 100644
--- a/src/osmo-bts-octphy/l1_tch.c
+++ b/src/osmo-bts-octphy/l1_tch.c
@@ -38,44 +38,6 @@
 
 #include "l1_if.h"
 
-/* input octet-aligned, output not octet-aligned */
-void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in,
-			     unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	/* first byte: upper nibble empty, lower nibble from src */
-	out[0] = (in[0] >> 4);
-
-	/* bytes 1.. */
-	for (i = 1; i < num_whole_bytes; i++)
-		out[i] = ((in[i - 1] & 0xF) << 4) | (in[i] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = ((in[i - 1] & 0xF) << 4) | (in[i] >> 4);
-	else
-		out[i] = (in[i - 1] & 0xF) << 4;
-}
-
-/* input unaligned, output octet-aligned */
-void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in,
-				 unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	for (i = 0; i < num_whole_bytes; i++)
-		out[i] = ((in[i] & 0xF) << 4) | (in[i + 1] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = (in[i] & 0xF) << 4;
-}
-
 struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len)
 {
 	struct msgb *msg;
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 527f9e1..39feae1 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -52,46 +52,6 @@
 #include "femtobts.h"
 #include "l1_if.h"
 
-/* input octet-aligned, output not octet-aligned */
-void osmo_nibble_shift_right(uint8_t *out, const uint8_t *in,
-			     unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	/* first byte: upper nibble empty, lower nibble from src */
-	out[0] = (in[0] >> 4);
-
-	/* bytes 1.. */
-	for (i = 1; i < num_whole_bytes; i++)
-		out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = ((in[i-1] & 0xF) << 4) | (in[i] >> 4);
-	else
-		out[i] = (in[i-1] & 0xF) << 4;
-}
-
-
-/* input unaligned, output octet-aligned */
-void osmo_nibble_shift_left_unal(uint8_t *out, const uint8_t *in,
-				unsigned int num_nibbles)
-{
-	unsigned int i;
-	unsigned int num_whole_bytes = num_nibbles / 2;
-
-	for (i = 0; i < num_whole_bytes; i++)
-		out[i] = ((in[i] & 0xF) << 4) | (in[i+1] >> 4);
-
-	/* shift the last nibble, in case there's an odd count */
-	i = num_whole_bytes;
-	if (num_nibbles & 1)
-		out[i] = (in[i] & 0xF) << 4;
-}
-
-
 static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len,
 					struct gsm_lchan *lchan)
 {

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

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



More information about the gerrit-log mailing list