change method name to resize intervals

master
Francisco Paisana 4 years ago
parent 4457bbda7e
commit 9146e6ddf1

@ -56,14 +56,14 @@ public:
stop_ = stop_point;
}
void expand_by(T len)
void resize_by(T len)
{
// Detect length overflows
assert(std::is_unsigned<T>::value or (len >= 0 or length() >= -len));
stop_ += len;
}
void expand_to(T len)
void resize_to(T len)
{
assert(std::is_unsigned<T>::value or len >= 0);
stop_ = start_ + len;

@ -79,12 +79,12 @@ int test_interval_expand()
srslte::interval<uint32_t> I{};
srslte::interval<int> I2{};
I.expand_by(5);
I.resize_by(5);
TESTASSERT(I.length() == 5);
I.expand_by(-5);
I.resize_by(-5);
TESTASSERT(I.length() == 0);
I2.expand_by(3);
I2.resize_by(3);
TESTASSERT(I2.length() == 3);
// I2.expand_by(-4);

@ -538,7 +538,7 @@ bool sf_grid_t::find_ul_alloc(uint32_t L, prb_interval* alloc) const
alloc->displace_to(n);
}
if (not ul_mask.test(n)) {
alloc->expand_by(1);
alloc->resize_by(1);
} else if (alloc->length() > 0) {
// avoid edges
if (n < 3) {
@ -554,7 +554,7 @@ bool sf_grid_t::find_ul_alloc(uint32_t L, prb_interval* alloc) const
// Make sure L is allowed by SC-FDMA modulation
while (!srslte_dft_precoding_valid_prb(alloc->length())) {
alloc->expand_by(-1);
alloc->resize_by(-1);
}
return alloc->length() == L;
}

@ -212,7 +212,7 @@ bool ul_metric_rr::find_allocation(uint32_t L, prb_interval* alloc)
alloc->displace_to(n);
}
if (not used_rb->test(n)) {
alloc->expand_by(1);
alloc->resize_by(1);
} else if (alloc->length() > 0) {
// avoid edges
if (n < 3) {
@ -228,7 +228,7 @@ bool ul_metric_rr::find_allocation(uint32_t L, prb_interval* alloc)
// Make sure L is allowed by SC-FDMA modulation
while (!srslte_dft_precoding_valid_prb(alloc->length())) {
alloc->expand_by(-1);
alloc->resize_by(-1);
}
return alloc->length() == L;
}

Loading…
Cancel
Save