Skip to content

Commit

Permalink
Attempt to fix different test results on GCC vs. clang and others.
Browse files Browse the repository at this point in the history
Possibly GCC handles arithmetic shift differently and the binary search
doesn't find code points?
  • Loading branch information
Rot127 committed Feb 15, 2025
1 parent 10f3a5e commit 2fae7df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions librz/util/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,17 @@ const RzUnicodeRangeTable undefined_ranges = {
};

static bool bin_search_range(RzCodePoint cp, const RzUnicodeRangeTable table, size_t table_size) {
int low = 0;
int hi = table_size - 1;
size_t low = 0;
size_t hi = table_size - 1;

do {
int mid = (low + hi) >> 1;
size_t mid = (low + hi) >> 1;
if (cp >= table[mid].from && cp <= table[mid].to) {
return true;
}
if (low == hi) {
break;
}
if (mid < table_size && cp > table[mid].to) {
low = mid + 1;
}
Expand Down

0 comments on commit 2fae7df

Please sign in to comment.