Skip to content

Commit

Permalink
Fix issue 16385: do not pass 0 to bsr, it has undefined return value
Browse files Browse the repository at this point in the history
  • Loading branch information
rainers committed Aug 14, 2016
1 parent 41a1d2b commit 0d213a9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions std/range/primitives.d
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,11 @@ if (isNarrowString!(C[]))
//ptr is used to avoid unnnecessary bounds checking.
str = str.ptr[1 .. str.length];
}
else if (c == 0xff)
{
// bsr undefined for 0
str = str.ptr[1 .. str.length];
}
else
{
import core.bitop : bsr;
Expand Down

0 comments on commit 0d213a9

Please sign in to comment.