// 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<const unsigned char *>(src), c, n);
+ reinterpret_cast<const unsigned char *>(src),
+ static_cast<unsigned char>(c), n);
}
} // namespace __llvm_libc
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<uint16_t>(
+ _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) {
LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) {
const unsigned char *str = reinterpret_cast<const unsigned char *>(src);
- const unsigned char ch = c;
+ const unsigned char ch = static_cast<unsigned char>(c);
for (; n != 0; --n) {
const unsigned char *s = str + n - 1;
if (*s == ch)
// 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<char>(c);
for (; *src && *src != ch; ++src)
;
return *src == ch ? const_cast<char *>(src) : nullptr;
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(char *, strrchr, (const char *src, int c)) {
- const char ch = c;
+ const char ch = static_cast<char>(c);
char *last_occurrence = nullptr;
for (; *src; ++src) {
if (*src == ch)