Skip to content

Commit 31c1624

Browse files
committed
Update unicode-db.hpp to fix gcc 10 warnings
1 parent 1ab1d9d commit 31c1624

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

include/unicode-db/unicode-db.hpp

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -239,31 +239,39 @@ struct bool_trie {
239239
constexpr bool lookup(char32_t u) const {
240240
std::uint32_t c = u;
241241
if(c < 0x800) {
242-
if constexpr(r1_s == 0)
242+
if constexpr(r1_s == 0){
243243
return false;
244-
return trie_range_leaf(c, r1[c >> 6]);
244+
}
245+
else {
246+
return trie_range_leaf(c, r1[c >> 6]);
247+
}
245248
} else if(c < 0x10000) {
246-
if constexpr(r3_s == 0)
249+
if constexpr(r3_s == 0) {
247250
return false;
248-
std::size_t i = ((c >> 6) - 0x20);
249-
auto child = 0;
250-
if(i >= r2_t_f && i < r2_t_f + r2_s)
251-
child = r2[i - r2_t_f];
252-
253-
return trie_range_leaf(c, r3[child]);
251+
}
252+
else {
253+
std::size_t i = ((c >> 6) - 0x20);
254+
auto child = 0;
255+
if(i >= r2_t_f && i < r2_t_f + r2_s)
256+
child = r2[i - r2_t_f];
257+
return trie_range_leaf(c, r3[child]);
258+
}
254259
} else {
255260
if constexpr(r6_s == 0)
256261
return false;
257262
std::size_t i4 = (c >> 12) - 0x10;
258263
auto child = 0;
259-
if(i4 >= r4_t_f && i4 < r4_t_f + r4_s)
260-
child = r4[i4 - r4_t_f];
261-
264+
if constexpr(r4_s > 0) {
265+
if(i4 >= r4_t_f && i4 < r4_t_f + r4_s)
266+
child = r4[i4 - r4_t_f];
267+
}
262268

263269
std::size_t i5 = (child << 6) + ((c >> 6) & 0x3f);
264270
auto leaf = 0;
265-
if(i5 >= r5_t_f && i5 < r5_t_f + r5_s)
266-
leaf = r5[i5 - r5_t_f];
271+
if constexpr(r5_s > 0) {
272+
if(i5 >= r5_t_f && i5 < r5_t_f + r5_s)
273+
leaf = r5[i5 - r5_t_f];
274+
}
267275
return trie_range_leaf(c, r6[leaf]);
268276
}
269277
}

0 commit comments

Comments
 (0)