aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_coding_scheme.h
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-09-08 12:33:34 +0200
committerMax <msuraev@sysmocom.de>2017-09-08 12:51:03 +0200
commit1962136a333a03e3ed33e96f4fb350fad61b3170 (patch)
tree439f09c6386a70199e6557d83241f3ea73672bec /src/gprs_coding_scheme.h
parent5a6bcfb7977b9db8964016582e51218a60c8431f (diff)
Assert valid CS
The coding scheme converted to number make sense only if it's valid. This is implicitly assumed by the code using this conversion as non-zero value. Make those assumptions explicit with OSMO_ASSERT(). Change-Id: I8f62627b7b7b89dfa1b0d1a7e71b95b2c40fdffa Fixes: CID70466
Diffstat (limited to 'src/gprs_coding_scheme.h')
-rw-r--r--src/gprs_coding_scheme.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index 3b153724..dfad240b 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -23,6 +23,9 @@
#include <stdint.h>
#include <stddef.h>
+extern "C" {
+ #include <osmocom/core/utils.h>
+}
class GprsCodingScheme {
public:
@@ -236,6 +239,9 @@ inline GprsCodingScheme::Scheme GprsCodingScheme::get_retx_mcs(
const GprsCodingScheme demanded_mcs,
const unsigned arq_type)
{
+ OSMO_ASSERT(mcs.to_num() > 0);
+ OSMO_ASSERT(demanded_mcs.to_num() > 0);
+
return egprs_mcs_retx_tbl[arq_type][mcs.to_num() - 1]
[demanded_mcs.to_num() - 1];
}