diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-11-28 20:21:25 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-11-28 20:21:25 +0100 |
commit | d67f84b6d54cd163aece37838f3278b11d597440 (patch) | |
tree | 62d27f1e7f48f016f2e51170fd0e1085273fb2cb | |
parent | e55cfe32b05f8adeae9873ca0b9092a7b5113b38 (diff) |
Fix handling zero matches.
Don't try to compute log(0).
-rw-r--r-- | reselect | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -26,9 +26,11 @@ sub hint_iterator { my ($len) = @_; # generate fixed-length codes of sufficient length for all matches - my $code_len = POSIX::ceil(log($len) / log(@hintchars)); - if ($code_len == 0) { + my $code_len; + if ($len == 0) { $code_len = 1; + } else { + $code_len = POSIX::ceil(log($len) / log(@hintchars)); } my $state = 0; |