[libc-commits] [libc] dbd38b1 - [libc] Add missing cast in x86 big_endian_cmp_mask

Roland McGrath via libc-commits libc-commits at lists.llvm.org
Fri Jun 30 14:16:18 PDT 2023


Author: Roland McGrath
Date: 2023-06-30T14:15:59-07:00
New Revision: dbd38b121920d82cc9b6464f7d8b5b5b4d8c8698

URL: https://github.com/llvm/llvm-project/commit/dbd38b121920d82cc9b6464f7d8b5b5b4d8c8698
DIFF: https://github.com/llvm/llvm-project/commit/dbd38b121920d82cc9b6464f7d8b5b5b4d8c8698.diff

LOG: [libc] Add missing cast in x86 big_endian_cmp_mask

Implicit narrowing conversions from int to uint16_t
get a compiler warning with the warning settings used
in the Fuchsia build.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D154256

Added: 
    

Modified: 
    libc/src/string/memory_utils/op_x86.h

Removed: 
    


################################################################################
diff  --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h
index 2bfa62eb155ad7..87585419770e76 100644
--- a/libc/src/string/memory_utils/op_x86.h
+++ b/libc/src/string/memory_utils/op_x86.h
@@ -129,7 +129,7 @@ LIBC_INLINE __m128i bytewise_reverse(__m128i value) {
                                               8, 9, 10, 11, 12, 13, 14, 15));
 }
 LIBC_INLINE uint16_t big_endian_cmp_mask(__m128i max, __m128i value) {
-  return _mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value)));
+  return static_cast<uint16_t>(_mm_movemask_epi8(bytewise_reverse(_mm_cmpeq_epi8(max, value))));
 }
 template <> LIBC_INLINE bool eq<__m128i>(CPtr p1, CPtr p2, size_t offset) {
   const auto a = load<__m128i>(p1, offset);


        


More information about the libc-commits mailing list