Skip to content

Commit

Permalink
Expose the type-oblivious memcmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Pizlo committed May 21, 2024
1 parent 26fc666 commit 2bbb325
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/string/memcmp.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <string.h>
#include <stdfil.h>

int memcmp(const void *vl, const void *vr, size_t n)
{
const unsigned char *l=vl, *r=vr;
for (; n && *l == *r; n--, l++, r++);
return n ? *l-*r : 0;
return zmemcmp(vl, vr, n);
}

0 comments on commit 2bbb325

Please sign in to comment.