include: Use macro BIT for shift operations

Use a macro BIT when dealing with bit shift operations.

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2019-03-08 12:35:46 -08:00 committed by Anas Nashif
commit 95eb2b4fed
12 changed files with 38 additions and 38 deletions

View file

@ -219,7 +219,7 @@ extern "C" {
.source_id = _id \
}; \
\
if ((1 << _level) & LOG_FUNCTION_PREFIX_MASK) { \
if (BIT(_level) & LOG_FUNCTION_PREFIX_MASK) { \
__LOG_INTERNAL(src_level, \
Z_LOG_STR(__VA_ARGS__)); \
} else { \
@ -300,7 +300,7 @@ extern "C" {
#define LOG_FILTERS_NUM_OF_SLOTS (32 / LOG_FILTER_SLOT_SIZE)
/** @brief Slot mask. */
#define LOG_FILTER_SLOT_MASK ((1 << LOG_FILTER_SLOT_SIZE) - 1)
#define LOG_FILTER_SLOT_MASK (BIT(LOG_FILTER_SLOT_SIZE) - 1)
/** @brief Bit offset of a slot.
*

View file

@ -68,7 +68,7 @@ extern "C" {
#define LOG_MSG_HEXDUMP_LENGTH_BITS 14
/** @brief Maximum length of log hexdump message. */
#define LOG_MSG_HEXDUMP_MAX_LENGTH ((1 << LOG_MSG_HEXDUMP_LENGTH_BITS) - 1)
#define LOG_MSG_HEXDUMP_MAX_LENGTH (BIT(LOG_MSG_HEXDUMP_LENGTH_BITS) - 1)
/** @brief Part of log message header identifying source and level. */
struct log_msg_ids {