[libcxx-commits] [libcxx] c34aca8 - [libc++][NFC] Remove unnecessary unsigned comparison with 0 (#108391)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 13 06:23:59 PDT 2024


Author: Mital Ashok
Date: 2024-09-13T09:23:54-04:00
New Revision: c34aca8ddc214b2ade997085e56689378ef1a8d0

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

LOG: [libc++][NFC] Remove unnecessary unsigned comparison with 0 (#108391)

This fixes a `-Wtype-limits` warning emitted when this file is compiled
with GCC when assertions are enabled.

Added: 
    

Modified: 
    libcxx/include/experimental/__simd/vec_ext.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h
index 1f707cf3e18424..6c7fb8b09a467c 100644
--- a/libcxx/include/experimental/__simd/vec_ext.h
+++ b/libcxx/include/experimental/__simd/vec_ext.h
@@ -40,11 +40,11 @@ struct __simd_storage<_Tp, simd_abi::__vec_ext<_Np>> {
   _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
 
   _LIBCPP_HIDE_FROM_ABI _Tp __get(size_t __idx) const noexcept {
-    _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+    _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds");
     return __data[__idx];
   }
   _LIBCPP_HIDE_FROM_ABI void __set(size_t __idx, _Tp __v) noexcept {
-    _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx >= 0 && __idx < _Np, "Index is out of bounds");
+    _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(__idx < _Np, "Index is out of bounds");
     __data[__idx] = __v;
   }
 };


        


More information about the libcxx-commits mailing list