Mercurial > hg > octave-lyh
diff liboctave/idx-vector.h @ 9985:43a29eeda994
fix idx_vector::loop for masks
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 15 Dec 2009 10:01:35 +0100 |
parents | 83bd7f34f9da |
children | 4c0cdbe0acca |
line wrap: on
line diff
--- 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;