[libc-commits] [PATCH] D84469: [libc] Adds implementation for memrchr.

Chris Gyurgyik via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jul 23 16:58:45 PDT 2020


cgyurgyik added inline comments.


================
Comment at: libc/src/string/memrchr.cpp:18
+  const unsigned char ch = c;
+  while (--n) {
+    if (str[n] == ch)
----------------
lntue wrote:
> I think this will be a trouble if n == 0 because n is unsigned.
You're right. Good catch, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84469





More information about the libc-commits mailing list