include: Add missing U for unsigned constants

MISRA-C rule 10.1

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2019-03-14 14:40:28 -07:00 committed by Anas Nashif
commit 5f5377f225
2 changed files with 10 additions and 6 deletions

View file

@ -10,6 +10,7 @@
#include <logging/log_instance.h> #include <logging/log_instance.h>
#include <misc/util.h> #include <misc/util.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -26,10 +27,13 @@ extern "C" {
#endif #endif
#define LOG_FUNCTION_PREFIX_MASK \ #define LOG_FUNCTION_PREFIX_MASK \
((IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_ERR) << LOG_LEVEL_ERR) | \ (((u32_t)IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_ERR) << \
(IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_WRN) << LOG_LEVEL_WRN) | \ LOG_LEVEL_ERR) | \
(IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_INF) << LOG_LEVEL_INF) | \ ((u32_t)IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_WRN) << \
(IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_DBG) << LOG_LEVEL_DBG)) LOG_LEVEL_WRN) | \
((u32_t)IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_INF) << \
LOG_LEVEL_INF) | \
((u32_t)IS_ENABLED(CONFIG_LOG_FUNC_NAME_PREFIX_DBG) << LOG_LEVEL_DBG))
/** @brief Macro for returning local level value if defined or default. /** @brief Macro for returning local level value if defined or default.
* *

View file

@ -96,14 +96,14 @@ constexpr size_t ARRAY_SIZE(T(&)[N]) { return N; }
static inline bool is_power_of_two(unsigned int x) static inline bool is_power_of_two(unsigned int x)
{ {
return (x != 0) && !(x & (x - 1)); return (x != 0U) && ((x & (x - 1)) == 0U);
} }
static inline s64_t arithmetic_shift_right(s64_t value, u8_t shift) static inline s64_t arithmetic_shift_right(s64_t value, u8_t shift)
{ {
s64_t sign_ext; s64_t sign_ext;
if (shift == 0) { if (shift == 0U) {
return value; return value;
} }