diff options
author | Max <msuraev@sysmocom.de> | 2019-03-25 16:32:50 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2019-03-26 11:19:30 +0100 |
commit | 8a8e0fb2675878c045d9770da0940c7c895b89ec (patch) | |
tree | f24bf858ddbc36b3f51ca0270a56b5a4e606e5f0 /src/gprs_coding_scheme.h | |
parent | fb3fd093536af6c4f40709b8170bf32cf435fc94 (diff) |
MCS: add mcs_is_*() helpers
In preparation for Channel Coding Command encoder in follow-up patches
let's add necessary helpers. Those are similar to previously used
helpers from GprsCodingScheme class but without CamelCase and with less
typo chances between Gprs and Egprs cases.
Change-Id: I6699cbc8d7ae766fa4d2b3d37e5f9ff1cf158b7e
Diffstat (limited to 'src/gprs_coding_scheme.h')
-rw-r--r-- | src/gprs_coding_scheme.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h index 6f965d68..728ffd66 100644 --- a/src/gprs_coding_scheme.h +++ b/src/gprs_coding_scheme.h @@ -45,9 +45,7 @@ public: GprsCodingScheme& operator =(GprsCodingScheme o); bool isValid() const {return UNKNOWN <= m_scheme && m_scheme <= MCS9;} - bool isGprs() const {return CS1 <= m_scheme && m_scheme <= CS4;} - bool isEgprs() const {return m_scheme >= MCS1;} - bool isEgprsGmsk() const {return isEgprs() && m_scheme <= MCS4;} + bool isCompatible(enum mcs_kind mode) const; bool isCompatible(GprsCodingScheme o) const; bool isFamilyCompatible(GprsCodingScheme o) const; @@ -86,10 +84,10 @@ private: inline uint8_t GprsCodingScheme::to_num() const { - if (isGprs()) + if (mcs_is_gprs(m_scheme)) return (m_scheme - CS1) + 1; - if (isEgprs()) + if (mcs_is_edge(m_scheme)) return (m_scheme - MCS1) + 1; return 0; @@ -98,9 +96,9 @@ inline uint8_t GprsCodingScheme::to_num() const inline bool GprsCodingScheme::isCompatible(enum mcs_kind mode) const { switch (mode) { - case GPRS: return isGprs(); - case EGPRS_GMSK: return isEgprsGmsk(); - case EGPRS: return isEgprs(); + case GPRS: return mcs_is_gprs(m_scheme); + case EGPRS_GMSK: return mcs_is_edge_gmsk(m_scheme); + case EGPRS: return mcs_is_edge(m_scheme); } return false; @@ -108,7 +106,7 @@ inline bool GprsCodingScheme::isCompatible(enum mcs_kind mode) const inline bool GprsCodingScheme::isCompatible(GprsCodingScheme o) const { - return (isGprs() && o.isGprs()) || (isEgprs() && o.isEgprs()); + return (mcs_is_gprs(m_scheme) && mcs_is_gprs(o)) || (mcs_is_edge(m_scheme) && mcs_is_edge(o)); } inline GprsCodingScheme::GprsCodingScheme(CodingScheme s) |