blob: 5c56878354a81689fa19c8e2396b2f64fabe80ef (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include <string.h>
#include "mbstring.h"
/* Technically you can’t pass nullptr to memcmp(), so we check for x.len and
y.len both being 0 */
int
u8cmp(u8view_t x, u8view_t y)
{
if (x.len != y.len)
return x.len > y.len ? +1 : -1;
return x.len == 0 && y.len == 0 ? 0 : memcmp(x.p, y.p, x.len);
}
|