rlc/tbf: Move the loop into the gprs_rlc_v_b class
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 1a2aa0f..1a05546 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -37,3 +37,16 @@
for (size_t i = 0; i < ARRAY_SIZE(m_v_b); ++i)
mark_invalid(i);
}
+
+int gprs_rlc_v_b::resend_needed(const uint16_t v_a, const uint16_t v_s,
+ const uint16_t mod_sns,
+ const uint16_t mod_sns_half)
+{
+ for (uint8_t bsn = v_a; bsn != v_s; bsn = (bsn + 1) & mod_sns) {
+ uint16_t index = bsn & mod_sns_half;
+ if (is_nacked(index) || is_resend(index))
+ return bsn;
+ }
+
+ return -1;
+}