[libcxx-commits] [libcxx] [libc++][NFC] Remove unnecessary unsigned comparison with 0 (PR #108391)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 12 06:44:56 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Mital Ashok (MitalAshok)
<details>
<summary>Changes</summary>
This fixes a `-Wtype-limits` warning emitted when this file is compiled with GCC when assertions are enabled.
---
Full diff: https://github.com/llvm/llvm-project/pull/108391.diff
1 Files Affected:
- (modified) libcxx/include/experimental/__simd/vec_ext.h (+2-2)
``````````diff
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;
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/108391
More information about the libcxx-commits
mailing list