[Issue 3037] Off-by-one error in Stride.length

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 27 23:38:35 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3037





--- Comment #2 from Andrei Alexandrescu <andrei at metalanguage.com>  2009-08-27 23:38:34 PDT ---
(In reply to comment #1)
> I fixed length like this:
> 
> return (_input.length - 1) / _n + 1;
> 
> Thanks!

In fact this doesn't work for _input.length == 0. So I rewrote it as:

return (_input.length + _n - 1) / _n

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list