Skip to content

Commit 6958986

Browse files
[libc] fix -Wconversion (#77384)
Fixes the following from GCC: llvm-project/libc/src/string/memory_utils/op_x86.h:236:24: error: conversion from ‘long unsigned int’ to ‘uint32_t’ {aka ‘unsigned int’} may change value [-Werror=conversion] 236 | return (xored >> 32) | (xored & 0xFFFFFFFF); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ Link: https://lab.llvm.org/buildbot/#/builders/250/builds/16236/steps/8/logs/stdio Link: #74506
1 parent a0ae525 commit 6958986

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libc/src/string/memory_utils/op_x86.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ template <> LIBC_INLINE uint32_t neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {
233233
const auto a = load<__m512i>(p1, offset);
234234
const auto b = load<__m512i>(p2, offset);
235235
const uint64_t xored = _mm512_cmpneq_epi8_mask(a, b);
236-
return (xored >> 32) | (xored & 0xFFFFFFFF);
236+
return static_cast<uint32_t>(xored >> 32) |
237+
static_cast<uint32_t>(xored & 0xFFFFFFFF));
237238
}
238239
template <>
239240
LIBC_INLINE MemcmpReturnType cmp_neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {

0 commit comments

Comments
 (0)