From 9829e7f89469a828d216e9558c259253bd11dda9 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Tue, 19 Nov 2019 06:53:22 -0800 Subject: [PATCH] liblog: Assure shifting behavior is consistent Shifting a signed 32-bit value by 31 bits is implementation- defined behavior. So we change to an unsigned value for our shift by 31 bits, and go ahead and change the others to unsigned for consistency. Test: TreeHugger Change-Id: Ib98f9b1e468d28dafd09e86273bf76beb1ea1fa5 --- liblog/logger.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/liblog/logger.h b/liblog/logger.h index d2251e578..f0a4a9267 100644 --- a/liblog/logger.h +++ b/liblog/logger.h @@ -85,9 +85,9 @@ struct logger_list { // bits 0-2: the decimal value of the log buffer. // Other bits are unused. -#define LOGGER_LOGD (1 << 31) -#define LOGGER_PMSG (1 << 30) -#define LOGGER_LOG_ID_MASK ((1 << 3) - 1) +#define LOGGER_LOGD (1U << 31) +#define LOGGER_PMSG (1U << 30) +#define LOGGER_LOG_ID_MASK ((1U << 3) - 1) inline bool android_logger_is_logd(struct logger* logger) { return reinterpret_cast(logger) & LOGGER_LOGD;