Skip to content

Commit 2d231f4

Browse files
committed
Fixes to find_pct_or_plus()
1 parent ae46e88 commit 2d231f4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/lib/lwan-request.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,11 @@ static char *find_pct_or_plus(const char *input)
293293
uint64_t m = LWAN_MAX(has_plus, has_pct);
294294

295295
if (has_zero && LWAN_MAX(has_zero, m) == has_zero) {
296-
switch (__builtin_ctzll(has_zero) / 8) {
297-
case 1 ... 3:
296+
const int zero_pos = __builtin_ctzll(has_zero) / 8;
297+
if (zero_pos >= 1 && zero_pos <= 3)
298298
goto check_small;
299-
case 4 ... 7:
299+
if (zero_pos >= 4 && zero_pos <= 7)
300300
goto check_at_least_four;
301-
default:
302-
return NULL;
303-
}
304301
}
305302

306303
if (m) {

0 commit comments

Comments
 (0)