string: Fix wrong comparison semantics
Chars are signed for x86 -- correct the comparison semantics.
Change-Id: I2049e98eb063c0b4e83ea973d3fcae49c6817dde
Author: Liubov Dmitrieva <liubov.dmitrieva@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c
index a533fef..aeb5643 100644
--- a/libc/string/memrchr.c
+++ b/libc/string/memrchr.c
@@ -35,10 +35,10 @@
const char* q = p + n;
while (1) {
- q--; if (q < p || q[0] == c) break;
- q--; if (q < p || q[0] == c) break;
- q--; if (q < p || q[0] == c) break;
- q--; if (q < p || q[0] == c) break;
+ q--; if (q < p || q[0] == (char) c) break;
+ q--; if (q < p || q[0] == (char) c) break;
+ q--; if (q < p || q[0] == (char) c) break;
+ q--; if (q < p || q[0] == (char) c) break;
}
if (q >= p)
return (void*)q;