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

host/trxcon/trx_ic.c: use osmo_ubit2sbit() from libosmocore

No need to reimplement the existing functions...

Change-Id: Ic9b232c8561609d42dac10e6249a3e1c58c4edc1
---
M src/host/trxcon/trx_if.c
1 file changed, 2 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/91/6791/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index d7f496e..1f5edb2 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -537,8 +537,8 @@
        sbit_t bits[148];
        int8_t rssi, tn;
        uint32_t fn;
-       int len, i;
        float toa;
+       int len;
 
        len = recv(ofd->fd, buf, sizeof(buf), 0);
        if (len <= 0)
@@ -556,12 +556,7 @@
        toa = ((int16_t) (buf[6] << 8) | buf[7]) / 256.0F;
 
        /* Copy and convert bits {254..0} to sbits {-127..127} */
-       for (i = 0; i < 148; i++) {
-               if (buf[8 + i] == 255)
-                       bits[i] = -127;
-               else
-                       bits[i] = 127 - buf[8 + i];
-       }
+       osmo_ubit2sbit(bits, buf + 8, 148);
 
        if (tn >= 8) {
                LOGP(DTRXD, LOGL_ERROR, "Illegal TS %d\n", tn);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9b232c8561609d42dac10e6249a3e1c58c4edc1
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to