change method name to resize intervals

This commit is contained in:
Francisco Paisana 2020-08-14 10:50:45 +01:00
parent 4457bbda7e
commit 9146e6ddf1
4 changed files with 9 additions and 9 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}