diff --git a/libc/src/string/memchr.cpp b/libc/src/string/memchr.cpp --- a/libc/src/string/memchr.cpp +++ b/libc/src/string/memchr.cpp @@ -17,7 +17,8 @@ // TODO: Look at performance benefits of comparing words. LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) { return internal::find_first_character( - reinterpret_cast(src), c, n); + reinterpret_cast(src), + static_cast(c), n); } } // namespace __llvm_libc diff --git a/libc/src/string/memory_utils/elements_x86.h b/libc/src/string/memory_utils/elements_x86.h --- a/libc/src/string/memory_utils/elements_x86.h +++ b/libc/src/string/memory_utils/elements_x86.h @@ -67,7 +67,8 @@ using T = char __attribute__((__vector_size__(SIZE))); static uint16_t mask(T value) { // NOLINTNEXTLINE(llvmlibc-callee-namespace) - return _mm_movemask_epi8(__llvm_libc::bit_cast<__m128i>(value)); + return static_cast( + _mm_movemask_epi8(__llvm_libc::bit_cast<__m128i>(value))); } static uint16_t not_equal_mask(T a, T b) { return mask(a != b); } static T load(const char *ptr) { diff --git a/libc/src/string/memrchr.cpp b/libc/src/string/memrchr.cpp --- a/libc/src/string/memrchr.cpp +++ b/libc/src/string/memrchr.cpp @@ -14,7 +14,7 @@ LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) { const unsigned char *str = reinterpret_cast(src); - const unsigned char ch = c; + const unsigned char ch = static_cast(c); for (; n != 0; --n) { const unsigned char *s = str + n - 1; if (*s == ch) diff --git a/libc/src/string/strchr.cpp b/libc/src/string/strchr.cpp --- a/libc/src/string/strchr.cpp +++ b/libc/src/string/strchr.cpp @@ -14,7 +14,7 @@ // TODO: Look at performance benefits of comparing words. LLVM_LIBC_FUNCTION(char *, strchr, (const char *src, int c)) { - const char ch = c; + const char ch = static_cast(c); for (; *src && *src != ch; ++src) ; return *src == ch ? const_cast(src) : nullptr; diff --git a/libc/src/string/strrchr.cpp b/libc/src/string/strrchr.cpp --- a/libc/src/string/strrchr.cpp +++ b/libc/src/string/strrchr.cpp @@ -13,7 +13,7 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(char *, strrchr, (const char *src, int c)) { - const char ch = c; + const char ch = static_cast(c); char *last_occurrence = nullptr; for (; *src; ++src) { if (*src == ch)