blob: a05f33c6a702de91c6fc18391ecff072836a7ef3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#ifndef RUNE_INTERNAL_COMMON_H
#define RUNE_INTERNAL_COMMON_H
/* IWYU pragma: private */
#include <limits.h>
#define lengthof(a) (sizeof(a) / sizeof(*(a)))
#define U1(x) (((x)&0x80) == 0x00)
#define U2(x) (((x)&0xE0) == 0xC0)
#define U3(x) (((x)&0xF0) == 0xE0)
#define U4(x) (((x)&0xF8) == 0xF0)
#define UC(x) (((x)&0xC0) == 0x80)
/* Maximum value of a 1–4-byte long UTF-8 sequence */
#include "rune.h"
#define _1B_MAX RUNE_C(0x00007F)
#define _2B_MAX RUNE_C(0x0007FF)
#define _3B_MAX RUNE_C(0x00FFFF)
#define _4B_MAX RUNE_C(0x10FFFF)
#define LATIN1_MAX 0xFF
#if BITINT_MAXWIDTH >= LATIN1_MAX + 1
# define BIT_LOOKUP 1
#endif
#endif /* !RUNE_INTERNAL_COMMON_H */
|