Mercurial > hg > octave-lojdl
changeset 8298:7e87d3d76a56
fix extent query for empty ranges
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 31 Oct 2008 12:09:16 +0100 |
parents | dc62132651db |
children | be9b14945774 |
files | liboctave/ChangeLog liboctave/idx-vector.h |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2008-10-31 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.h (idx_vector::idx_range_rep::extent): Don't change + extent when len is zero. + * idx-vector.h (idx_vector::idx_range_rep::idx_range_rep (void)): + Create empty range by default. + 2008-10-30 Jaroslav Hajek <highegg@gmail.com> * oct-inttypes.h (octave_int_abs): New function.
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -152,7 +152,7 @@ : idx_base_rep (), start(_start), len(_len), step(_step) { } idx_range_rep (void) - : start(0), len(1), step(1) { } + : start(0), len(0), step(1) { } // Zero-based constructor. idx_range_rep (octave_idx_type _start, octave_idx_type _limit, @@ -169,7 +169,7 @@ { return len; } octave_idx_type extent (octave_idx_type n) const - { return std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))); } + { return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))) : n; } idx_class_type idx_class () const { return class_range; }