pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29292 ) Change subject: utils.h: protect param with parenthesis in OSMO_BYTES_FOR_BITS() ...................................................................... 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 --- M include/osmocom/core/utils.h 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index ba2cafb..d0e2e9b 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)) -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29292 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I8b21eba9b9aa952f86abe7a6d4cdb1d1a61d9deb Gerrit-Change-Number: 29292 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: osmith <osmith@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: merged