memcmp: compare the first byte as well

MemcmpLowercase would not compare the first byte of both input buffers
leading to two non-identical buffers to be considered the same.

Affects SSE_4_1 and SSE_4_2 implementations of SCMemcmpLowercase, as well
as the non-SIMD implementation. SSE_3 and Tile version are not affected.
pull/1294/head
Victor Julien 11 years ago
parent c51ce4d2c0
commit 17dfd59bc3

@ -41,12 +41,12 @@ void MemcmpRegisterTests(void);
static inline int
MemcmpLowercase(const void *s1, const void *s2, size_t n)
{
size_t i;
ssize_t i;
/* check backwards because we already tested the first
* 2 to 4 chars. This way we are more likely to detect
* a miss and thus speed up a little... */
for (i = n - 1; i; i--) {
for (i = n - 1; i >= 0; i--) {
if (((uint8_t *)s1)[i] != u8_tolower(*(((uint8_t *)s2)+i)))
return 1;
}

Loading…
Cancel
Save