[libcxx-commits] [PATCH] D159509: [libcxx] <experimental/simd> Fix CI errors on 32-bits x86

Yin Zhang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 13 00:08:12 PDT 2023


Joy12138 updated this revision to Diff 556631.
Joy12138 added a comment.

Fix index range


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159509/new/

https://reviews.llvm.org/D159509

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


Index: libcxx/include/experimental/__simd/vec_ext.h
===================================================================
--- libcxx/include/experimental/__simd/vec_ext.h
+++ libcxx/include/experimental/__simd/vec_ext.h
@@ -31,11 +31,11 @@
   _Tp __data __attribute__((__vector_size__(std::__bit_ceil((sizeof(_Tp) * _Np)))));
 
   _Tp __get(size_t __idx) const noexcept {
-    _LIBCPP_ASSERT_UNCATEGORIZED(__idx > 0 && __idx <= _Np, "Index is out of bounds");
+    _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
     return __data[__idx];
   }
   void __set(size_t __idx, _Tp __v) noexcept {
-    _LIBCPP_ASSERT_UNCATEGORIZED(__idx > 0 && __idx <= _Np, "Index is out of bounds");
+    _LIBCPP_ASSERT_UNCATEGORIZED(__idx >= 0 && __idx < _Np, "Index is out of bounds");
     __data[__idx] = __v;
   }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159509.556631.patch
Type: text/x-patch
Size: 837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230913/8a26bb0b/attachment.bin>


More information about the libcxx-commits mailing list