Commit 2faca0fd authored by Robert Schmidt's avatar Robert Schmidt

Fix too large shift in nr_pucchsim

parent 7f4e8f92
...@@ -1774,7 +1774,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1774,7 +1774,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} }
bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3); bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3);
uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<bit_left)-1); uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<bit_left)-1);
decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1; decodedPayload[0] = pucch_pdu->bit_len_csi_part1 < 64 ? decodedPayload[0] >> pucch_pdu->bit_len_csi_part1 : 0;
} }
if (pucch_pdu->bit_len_csi_part2>0) { if (pucch_pdu->bit_len_csi_part2>0) {
......
...@@ -401,7 +401,7 @@ int main(int argc, char **argv) ...@@ -401,7 +401,7 @@ int main(int argc, char **argv)
srand(time(NULL)); // Initialization, should only be called once. srand(time(NULL)); // Initialization, should only be called once.
actual_payload = rand(); // Returns a pseudo-random integer between 0 and RAND_MAX. actual_payload = rand(); // Returns a pseudo-random integer between 0 and RAND_MAX.
} }
actual_payload &= ((1<<nr_bit)-1); actual_payload &= nr_bit < 64 ? (1UL << nr_bit) - 1: 0xffffffffffffffff;
printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX); printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment