diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2006-11-26 11:11:55 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2006-11-26 11:11:55 +0000 |
commit | 145a665014b2aa230b81b582689c8ec17ef9968e (patch) | |
tree | 5ea1019527fe16cc21b9702371c72cc7f8c8090c /app/xterm/unicode/precompose.c.tail | |
parent | 95c2d1cbda23a41cdf6e63520c7f0b825e63dd5b (diff) |
Importing xterm 216
Diffstat (limited to 'app/xterm/unicode/precompose.c.tail')
-rw-r--r-- | app/xterm/unicode/precompose.c.tail | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/xterm/unicode/precompose.c.tail b/app/xterm/unicode/precompose.c.tail new file mode 100644 index 000000000..0ceca9b6c --- /dev/null +++ b/app/xterm/unicode/precompose.c.tail @@ -0,0 +1,23 @@ +}; + +int do_precomposition(int base, int comb) { + int min = 0; + int max = sizeof(precompositions) / sizeof(precompositions[0]) - 1; + int mid; + unsigned int sought = ((unsigned)base << 16) | (unsigned)comb, that; + + /* binary search */ + while (max >= min) { + mid = (min + max) / 2; + that = ((unsigned)precompositions[mid].base << 16) | ((unsigned)precompositions[mid].comb); + if (that < sought) { + min = mid + 1; + } else if (that > sought) { + max = mid - 1; + } else { + return precompositions[mid].replacement; + } + } + /* no match */ + return -1; +} |