diff --git a/lib/include/srslte/common/bcd_helpers.h b/lib/include/srslte/common/bcd_helpers.h index b145a2d5a..abd596860 100644 --- a/lib/include/srslte/common/bcd_helpers.h +++ b/lib/include/srslte/common/bcd_helpers.h @@ -150,9 +150,9 @@ inline void s1ap_plmn_to_mccmnc(uint32_t plmn, uint16_t *mcc, uint16_t *mnc) *mnc |= nibbles[4]; // MNC digit 3 } else { // 3-digit MNC - *mnc |= nibbles[5] << 8; // MNC digit 1 - *mnc |= nibbles[4] << 4; // MNC digit 2 - *mnc |= nibbles[2] ; // MNC digit 3 + *mnc |= nibbles[2] << 8; // MNC digit 1 + *mnc |= nibbles[5] << 4; // MNC digit 2 + *mnc |= nibbles[4] ; // MNC digit 3 } } @@ -177,9 +177,9 @@ inline void s1ap_mccmnc_to_plmn(uint16_t mcc, uint16_t mnc, uint32_t *plmn) nibbles[4] = (mnc & 0x000F); // MNC digit 3 } else { // 3-digit MNC - nibbles[5] = (mnc & 0x0F00) >> 8; // MNC digit 1 - nibbles[4] = (mnc & 0x00F0) >> 4; // MNC digit 2 - nibbles[2] = (mnc & 0x000F); // MNC digit 3 + nibbles[2] = (mnc & 0x0F00) >> 8; // MNC digit 1 + nibbles[5] = (mnc & 0x00F0) >> 4; // MNC digit 2 + nibbles[4] = (mnc & 0x000F); // MNC digit 3 } *plmn = 0x000000; diff --git a/srsenb/test/upper/plmn_test.cc b/srsenb/test/upper/plmn_test.cc index 2f27febc3..448931129 100644 --- a/srsenb/test/upper/plmn_test.cc +++ b/srsenb/test/upper/plmn_test.cc @@ -65,7 +65,7 @@ void s1ap_plmn_test() // 3-digit MNC test mnc = 0xF456; srslte::s1ap_mccmnc_to_plmn(mcc, mnc, &plmn); - assert(plmn == 0x216354); + assert(plmn == 0x214365); srslte::s1ap_plmn_to_mccmnc(plmn, &mcc, &mnc); assert(mcc == 0xF123); assert(mnc == 0xF456);