aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-08 19:32:04 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-02-08 19:34:14 +0100
commitd15dc832c9da401d35300bf4c6d59235ee770bc5 (patch)
tree86d2702735ed3b1b972b32faa9e8fca5f25ae5db
parent16312669937281a7785bf069bbf428bfdbadcd60 (diff)
SACCH SI: assert that SI enum vals fit in bit mask
In case our SI enums ever move past 31, this static assert will warn us to enlarge osmo_si_shifted. Change-Id: I4185d7de590329ff5f523b241721c586ffdbcd8b
-rw-r--r--src/common/rsl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index c657b0f6..2f6c0c6a 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -689,6 +689,9 @@ static void copy_sacch_si_to_lchan(struct gsm_lchan *lchan)
uint8_t rsl_si = rsl_sacch_sitypes[i];
int osmo_si = osmo_rsl2sitype(rsl_si);
uint32_t osmo_si_shifted = (1 << osmo_si);
+ osmo_static_assert(_MAX_SYSINFO_TYPE <= sizeof(osmo_si_shifted) * 8,
+ si_enum_vals_fit_in_bit_mask);
+
if (osmo_si == SYSINFO_TYPE_NONE)
continue;
if (!(bts->si_valid & osmo_si_shifted)) {