aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-03-13 15:55:54 +0100
committerMax <msuraev@sysmocom.de>2019-03-19 18:27:49 +0100
commit02fbfc15c7678cb02a19b4c2f01f9efc80756d14 (patch)
tree05e6d88e532e816c3d3d8efa1bfff20d6c5c7c57
parenta0353547b11f7120b07cfa89af97a9c6de74be81 (diff)
Fix TA index encoder
The TAI is described as { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } in 3GPP TS 44.018 ยง10.5.2.16.1 so it should be encoded with if-else. Change-Id: I54482790e1cf3cb13a635a99a481250576deabaf
-rw-r--r--src/encoding.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/encoding.cpp b/src/encoding.cpp
index ad53b0b..e21a7fc 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -117,13 +117,13 @@ static int write_ta_index(bitvec *dest, int8_t tai)
{
int rc;
- if (tai < 0) /* No TIMING_ADVANCE_INDEX: */
+ if (tai < 0) { /* No TIMING_ADVANCE_INDEX: */
SET_0(dest);
-
- /* TIMING_ADVANCE_INDEX: */
- SET_1(dest);
- rc = bitvec_set_u64(dest, tai, 4, false);
- CHECK(rc);
+ } else { /* TIMING_ADVANCE_INDEX: */
+ SET_1(dest);
+ rc = bitvec_set_u64(dest, tai, 4, false);
+ CHECK(rc);
+ }
return 0;
}