diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-10-04 02:41:13 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-10-04 02:49:23 +0700 |
commit | 8deedfa2818c6854f91bf37fc36c80b4b7e73914 (patch) | |
tree | a91f50d792f9327616e7c828cf2240141bd8079c | |
parent | 395db204b40efdaf4e389a1a4ecc3ebd038c1198 (diff) |
gsm0502: use parentheses in GSM_TDMA_FN_{SUM,SUB} macros
This makes it possible to pass expressions to the abovementioned
macros without any side-effects. Strictly speaking, this is only
necessary for argument 'b' of GSM_TDMA_FN_SUB, but let's also add
them to GSM_TDMA_FN_SUM for consistency.
Change-Id: I7f26156813139bbb7774e1eb342c91bc84fdad38
-rw-r--r-- | include/osmocom/gsm/gsm0502.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/osmocom/gsm/gsm0502.h b/include/osmocom/gsm/gsm0502.h index 1be2cc39..b6a18077 100644 --- a/include/osmocom/gsm/gsm0502.h +++ b/include/osmocom/gsm/gsm0502.h @@ -16,10 +16,10 @@ /*! Return the sum of two specified TDMA frame numbers (summation) */ #define GSM_TDMA_FN_SUM(a, b) \ - ((a + b) % GSM_TDMA_HYPERFRAME) + (((a) + (b)) % GSM_TDMA_HYPERFRAME) /*! Return the difference of two specified TDMA frame numbers (subtraction) */ #define GSM_TDMA_FN_SUB(a, b) \ - ((a + GSM_TDMA_HYPERFRAME - b) % GSM_TDMA_HYPERFRAME) + (((a) + GSM_TDMA_HYPERFRAME - (b)) % GSM_TDMA_HYPERFRAME) /*! Return the *minimum* difference of two specified TDMA frame numbers (distance) */ #define GSM_TDMA_FN_DIFF(a, b) \ OSMO_MIN(GSM_TDMA_FN_SUB(a, b), GSM_TDMA_FN_SUB(b, a)) |