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
This commit is contained in:
Greg Kaiser 2019-11-19 06:53:22 -08:00
parent ba5351692e
commit 9829e7f894
1 changed files with 3 additions and 3 deletions

View File

@ -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<uintptr_t>(logger) & LOGGER_LOGD;