Mercurial > hg > octave-shane
changeset 9985:43a29eeda994
fix idx_vector::loop for masks
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 15 Dec 2009 10:01:35 +0100 |
parents | d1cc2e0ddf55 |
children | 672e1b49e01e |
files | liboctave/ChangeLog liboctave/idx-vector.h |
diffstat | 2 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-12-15 Jaroslav Hajek <highegg@gmail.com> + + * idx-vector.h (idx_vector::loop, idx_vector::bloop): Fix behavior for + masks. + 2009-12-13 Rik <octave@nomad.inbox5.com> * Makefile.am: Use DISTCLEANFILES rather than distclean-local rule.
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -824,8 +824,8 @@ idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); const bool *data = r->get_data (); octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0, j = 0; i < ext; i++) - if (data[i]) body (j++); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) body (i); } break; default: @@ -894,8 +894,16 @@ const bool *data = r->get_data (); octave_idx_type ext = r->extent (0), j = 0; for (octave_idx_type i = 0; i < ext; i++) - if (data[i] && body (j++)) - break; + { + if (data[i]) + { + if (body (i)) + break; + else + j++; + } + } + ret = j; } break;