asn1helpers: Add 28 bit conversion function and use it for Cell ID
The padding bits in the bit string are at the end and the byte-order is
MSB-first. This means the number needs to be shifted left so the padding
bits are the least significant.
diff --git a/src/tests/hnb-test.c b/src/tests/hnb-test.c
index 92170d5..6c717d0 100644
--- a/src/tests/hnb-test.c
+++ b/src/tests/hnb-test.c
@@ -144,13 +144,12 @@
lac = 0xc0fe;
sac = 0xabab;
rac = 0x42;
- cid = 0xadce00;
+ cid = 0xadceaab;
asn1_u16_to_str(&request.lac, &lac, lac);
asn1_u16_to_str(&request.sac, &sac, sac);
asn1_u8_to_str(&request.rac, &rac, rac);
- asn1_u32_to_bitstring(&request.cellIdentity, &cid, cid);
- request.cellIdentity.bits_unused = 4;
+ asn1_u28_to_bitstring(&request.cellIdentity, &cid, cid);
request.hnB_Identity.hNB_Identity_Info.buf = identity;
request.hnB_Identity.hNB_Identity_Info.size = strlen(identity);