Mercurial > octave
comparison libinterp/corefcn/typecast.cc @ 29931:7faff48840eb
prefer data over fortran_vec for read-only access to data
See also the discussion here: https://octave.discourse.group/t/rename-uses-of-fortran-vec-to-data-for-clarity/1439
* Array.h (const T * Array<T>::fortran_vec (void) const): Deprecate.
Change all uses to call data instead.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Jul 2021 11:46:05 -0400 |
parents | 7854d5752dd2 |
children | 32c3a5805893 |
comparison
equal
deleted
inserted
replaced
29930:aa98b5fdfbbb | 29931:7faff48840eb |
---|---|
320 std::numeric_limits<unsigned char>::digits != bitp.numel ()) | 320 std::numeric_limits<unsigned char>::digits != bitp.numel ()) |
321 error ("bitpack: incorrect number of bits to make up output value"); | 321 error ("bitpack: incorrect number of bits to make up output value"); |
322 | 322 |
323 ArrayType retval (get_vec_dims (bitp.dims (), n)); | 323 ArrayType retval (get_vec_dims (bitp.dims (), n)); |
324 | 324 |
325 const bool *bits = bitp.fortran_vec (); | 325 const bool *bits = bitp.data (); |
326 char *packed = reinterpret_cast<char *> (retval.fortran_vec ()); | 326 char *packed = reinterpret_cast<char *> (retval.fortran_vec ()); |
327 | 327 |
328 octave_idx_type m = n * sizeof (T); | 328 octave_idx_type m = n * sizeof (T); |
329 | 329 |
330 for (octave_idx_type i = 0; i < m; i++) | 330 for (octave_idx_type i = 0; i < m; i++) |
468 octave_idx_type n = array.numel () * sizeof (T) | 468 octave_idx_type n = array.numel () * sizeof (T) |
469 * std::numeric_limits<unsigned char>::digits; | 469 * std::numeric_limits<unsigned char>::digits; |
470 | 470 |
471 boolNDArray retval (get_vec_dims (array.dims (), n)); | 471 boolNDArray retval (get_vec_dims (array.dims (), n)); |
472 | 472 |
473 const char *packed = reinterpret_cast<const char *> (array.fortran_vec ()); | 473 const char *packed = reinterpret_cast<const char *> (array.data ()); |
474 bool *bits = retval.fortran_vec (); | 474 bool *bits = retval.fortran_vec (); |
475 | 475 |
476 octave_idx_type m = n / std::numeric_limits<unsigned char>::digits; | 476 octave_idx_type m = n / std::numeric_limits<unsigned char>::digits; |
477 | 477 |
478 for (octave_idx_type i = 0; i < m; i++) | 478 for (octave_idx_type i = 0; i < m; i++) |