aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-09-08 14:14:08 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2022-09-08 15:03:44 +0200
commit812766e231a5dc509e5a96837dcc81d6b0ec37a5 (patch)
tree92d8268c2b56b3f8dcb1785882052515d47f3c5b /include
parenta7f97b90939c9a67d9f86bb14ded4353d2015327 (diff)
utils.h: protect param with parenthesis in OSMO_BYTES_FOR_BITS()
While at it, drop 8-1 in favour of 7. I don't think it is really more understandable for readers to see some subtraction there... Change-Id: I8b21eba9b9aa952f86abe7a6d4cdb1d1a61d9deb
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/utils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index ba2cafbe..d0e2e9bf 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -33,7 +33,7 @@
/*! Make a value_string entry from an enum value name */
#define OSMO_VALUE_STRING(x) { x, #x }
/*! Number of bytes necessary to store given BITS */
-#define OSMO_BYTES_FOR_BITS(BITS) ((BITS + 8 - 1) / 8)
+#define OSMO_BYTES_FOR_BITS(BITS) (((BITS) + 7) / 8)
/*! Copy a C-string into a sized buffer using sizeof to detect buffer's size */
#define OSMO_STRLCPY_ARRAY(array, src) osmo_strlcpy(array, src, sizeof(array))