Fix bug: only sort relevant part of list

This reduces the amount of elements to compare.
This commit is contained in:
Robert Schmidt
2025-08-04 09:53:14 +02:00
parent dd98030202
commit 7ee8e8eaba
@@ -1869,7 +1869,7 @@ static void pf_ul(gNB_MAC_INST *nrmac,
int remainUEs[num_beams]; int remainUEs[num_beams];
for (int i = 0; i < num_beams; i++) for (int i = 0; i < num_beams; i++)
remainUEs[i] = max_num_ue; remainUEs[i] = max_num_ue;
int curUE = 0; int numUE = 0;
/* Loop UE_list to calculate throughput and coeff */ /* Loop UE_list to calculate throughput and coeff */
UE_iterator(UE_list, UE) { UE_iterator(UE_list, UE) {
@@ -2099,13 +2099,13 @@ static void pf_ul(gNB_MAC_INST *nrmac,
UE->ul_thr_ue, UE->ul_thr_ue,
tbs, tbs,
coeff_ue); coeff_ue);
UE_sched[curUE].coef = coeff_ue; UE_sched[numUE].coef = coeff_ue;
UE_sched[curUE].UE = UE; UE_sched[numUE].UE = UE;
UE_sched[curUE].selected_mcs = selected_mcs; UE_sched[numUE].selected_mcs = selected_mcs;
curUE++; numUE++;
} }
qsort(UE_sched, sizeofArray(UE_sched), sizeof(UEsched_t), comparator); qsort(UE_sched, numUE, sizeof(UEsched_t), comparator);
UEsched_t *iterator=UE_sched; UEsched_t *iterator=UE_sched;
/* Loop UE_sched to find max coeff and allocate transmission */ /* Loop UE_sched to find max coeff and allocate transmission */