Mercurial > octave
changeset 22117:9b832e9caae6
define forwarding functions for octave_int<T> xmin and xmax (bug #48139)
* lo-mappers.h (min, max): Define forwarding functions for
octave_int<T> types.
* MArray.cc (MArray<T>::idx_min, MArray<T>::idx_max): Use
octave::math::min and max as template parameters instead of xmin and
xmax.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 15 Jul 2016 10:43:48 -0400 |
parents | 03e30a5d6e0d |
children | 17c59e33b236 |
files | build-aux/mk-octave-config-h.sh liboctave/array/MArray.cc liboctave/numeric/lo-mappers.h oct-conf-post.in.h |
diffstat | 4 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/build-aux/mk-octave-config-h.sh Fri Jul 15 10:40:58 2016 -0400 +++ b/build-aux/mk-octave-config-h.sh Fri Jul 15 10:43:48 2016 -0400 @@ -120,7 +120,7 @@ /* # undef HAVE_OCTAVE_UNUSED_ATTR */ # endif -# define OCTAVE_USE_DEPRECATED_FUNCTIONS 1 +// # define OCTAVE_USE_DEPRECATED_FUNCTIONS 1 # if defined (__cplusplus) template <typename T>
--- a/liboctave/array/MArray.cc Fri Jul 15 10:40:58 2016 -0400 +++ b/liboctave/array/MArray.cc Fri Jul 15 10:43:48 2016 -0400 @@ -111,8 +111,8 @@ octave_quit (); octave_idx_type len = std::min (idx.length (n), vals.numel ()); - idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (), - vals.data ())); + idx.loop (len, _idxbinop_helper<T, octave::math::min> (this->fortran_vec (), + vals.data ())); } template <typename T> @@ -130,8 +130,8 @@ octave_quit (); octave_idx_type len = std::min (idx.length (n), vals.numel ()); - idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (), - vals.data ())); + idx.loop (len, _idxbinop_helper<T, octave::math::max> (this->fortran_vec (), + vals.data ())); } #include <iostream>
--- a/liboctave/numeric/lo-mappers.h Fri Jul 15 10:40:58 2016 -0400 +++ b/liboctave/numeric/lo-mappers.h Fri Jul 15 10:43:48 2016 -0400 @@ -29,6 +29,7 @@ #include <limits> #include "oct-cmplx.h" +#include "oct-inttypes-fwd.h" #include "lo-math.h" #include "lo-ieee.h" @@ -409,6 +410,20 @@ return abs (x) >= abs (y) ? x : (isnan (x) ? x : y); } + template <typename T> + inline octave_int<T> + min (const octave_int<T>& x, const octave_int<T>& y) + { + return xmin (x, y); + } + + template <typename T> + inline octave_int<T> + max (const octave_int<T>& x, const octave_int<T>& y) + { + return xmax (x, y); + } + // These map reals to Complex. extern OCTAVE_API Complex rc_acos (double);