diff options
Diffstat (limited to 'src/lib/unicode.c')
| -rw-r--r-- | src/lib/unicode.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/unicode.c b/src/lib/unicode.c index b5c6471..48cb91e 100644 --- a/src/lib/unicode.c +++ b/src/lib/unicode.c @@ -18,18 +18,28 @@ */ #include "aplwc_internal.h" -#include "unicode.h" +#include "unicode_properties.c" static int is(uint32_t c, enum unicode_property p) { - int n; + int n, a, b, i; struct unicode_range *r; - UNUSED_PARAMETER(c); - unicode_get(p, &n, &r); - + a = 0; + b = n-1; + while(a <= b){ + i = a + (b-a) / 2; + if(c >= r[i].from && c <= r[i].to) + return 1; + else if(c < r[i].from) + b = i-1; + else{ + assert(c > r[i].to); + a = i+1; + } + } return 0; } |