From dfbf34daf6238756beb475fbcc72bd70dbd4bd9c Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 26 Jun 2020 23:48:59 +0200 Subject: [PATCH] Remove a warning with some compiler by encoding 0 as UINT_MAX+1 --- m-string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-string.h b/m-string.h index 8f80802c..2f3cd60b 100644 --- a/m-string.h +++ b/m-string.h @@ -1325,7 +1325,7 @@ stringi_utf8_decode(char c, stringi_utf8_state_e *state, string_unicode_t *unicode) { const unsigned int type = m_core_clz32((unsigned char)~c) - (sizeof(uint32_t) - 1) * CHAR_BIT; - const string_unicode_t mask1 = -(string_unicode_t)(*state != STRINGI_UTF8_STARTING); + const string_unicode_t mask1 = (UINT_MAX - (string_unicode_t)(*state != STRINGI_UTF8_STARTING) + 1); const string_unicode_t mask2 = (0xFFU >> type); *unicode = ((*unicode << 6) & mask1) | ((unsigned int) c & mask2); *state = (stringi_utf8_state_e) STRINGI_UTF8_STATE_TAB[(unsigned int) *state + type];