7 #define LENGTH(x) ((int)(sizeof (x) / sizeof *(x)))
8 #define MIN(a, b) ((a) > (b) ? (b) : (a))
9 #define MAX(a, b) ((a) < (b) ? (b) : (a))
11 /* is c the start of a utf8 sequence? */
12 #define ISUTF8(c) (((c)&0xC0)!=0x80)
13 #define ISASCII(ch) ((unsigned char)ch < 0x80)
15 #if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
16 #define addu __builtin_add_overflow
18 static inline bool addu(size_t a
, size_t b
, size_t *c
) {
27 /* MIT licensed implementation from musl libc */
28 static void *memrchr(const void *m
, int c
, size_t n
)
30 const unsigned char *s
= m
;
32 while (n
--) if (s
[n
]==c
) return (void *)(s
+n
);
37 /* Needed for building on GNU Hurd */