ensure the DL mask count is reduced enough to fit required bytes

master
Francisco 4 years ago committed by Francisco Paisana
parent 4d3ff0d139
commit fa34aaa16e

@ -363,6 +363,13 @@ public:
return get_word_(0); return get_word_(0);
} }
void from_uint64(uint64_t v)
{
srsran_assert(nof_words_() == 1, "ERROR: cannot convert bitset of size=%zd to uint64_t", size());
srsran_assert(v < (1U << size()), "ERROR: Provided uint64=%ld does not fit in bitset of size=%zd", v, size());
buffer[0] = v;
}
template <typename OutputIt> template <typename OutputIt>
OutputIt to_hex(OutputIt&& mem_buffer) const noexcept OutputIt to_hex(OutputIt&& mem_buffer) const noexcept
{ {

@ -392,10 +392,15 @@ bool find_optimal_rbgmask(const sched_ue_cell& ue_cell,
}; };
std::tuple<uint32_t, int, uint32_t, int> ret = false_position_method( std::tuple<uint32_t, int, uint32_t, int> ret = false_position_method(
1U, tb_table.size(), (int)req_bytes.stop(), compute_tbs_approx, [](int y) { return y == SRSRAN_ERROR; }); 1U, tb_table.size(), (int)req_bytes.stop(), compute_tbs_approx, [](int y) { return y == SRSRAN_ERROR; });
uint32_t upper_nprb = std::get<2>(ret); uint32_t upper_nrbg = std::get<2>(ret);
int upper_tbs = std::get<3>(ret); int upper_tbs = std::get<3>(ret);
if (upper_tbs >= (int)req_bytes.stop()) { if (upper_tbs >= (int)req_bytes.stop()) {
tb = tb_table[upper_nprb - 1]; tb = tb_table[upper_nrbg - 1];
int pos = 0;
for (uint32_t n_rbgs = newtxmask.count(); n_rbgs > upper_nrbg; --n_rbgs) {
pos = newtxmask.find_lowest(pos + 1, newtxmask.size());
}
newtxmask.from_uint64(~((1U << (uint64_t)pos) - 1U) & ((1U << newtxmask.size()) - 1U));
} }
return true; return true;
} }

Loading…
Cancel
Save