pespin has uploaded this change for review. ( 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 i nfavour 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(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/29292/1
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))