lte: (fixes #346) ASN1 header gcc7 fix

This commit is contained in:
Tommaso Pecorella
2021-02-07 17:44:59 +00:00
parent 8a023818d0
commit e2edf298ab

View File

@@ -321,7 +321,14 @@ void Asn1Header::SerializeChoice (int numOptions, int selectedOption, bool isExt
void Asn1Header::SerializeInteger (int n, int nmin, int nmax) const
{
NS_ASSERT_MSG (nmin <= n && n <= nmax,
// The following is equivalent to:
// NS_ASSERT_MSG (nmin <= n && n <= nmax,
// "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]");
// This is a workaround to gcc-7 aggressive optimization, see #346, and can be dropped
// once gcc-7 will not be anymore supported.
long int nComp = nmin;
nComp -= n;
NS_ASSERT_MSG (nComp <= 0 && n <= nmax,
"Integer " << n << " is outside range [" << nmin << ", " << nmax << "]");
// Clause 11.5.3 ITU-T X.691