Mercurial > hg > octave-nkf
diff liboctave/lo-mappers.h @ 10268:9a16a61ed43d
new optimizations for accumarray
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 05 Feb 2010 12:09:21 +0100 |
parents | 4c0cdbe0acca |
children | 00219bdd2d17 |
line wrap: on
line diff
--- a/liboctave/lo-mappers.h +++ b/liboctave/lo-mappers.h @@ -69,6 +69,14 @@ extern OCTAVE_API bool octave_is_NA (double x); extern OCTAVE_API bool octave_is_NaN_or_NA (double x) GCC_ATTR_DEPRECATED; +// Generic xmin, xmax definitions +template <class T> +inline T xmin (T x, T y) +{ return x <= y ? x : y; } +template <class T> +inline T xmax (T x, T y) +{ return x >= y ? x : y; } + // This form is favorable. GCC will translate (x <= y ? x : y) without a jump, // hence the only conditional jump involved will be the first (xisnan), infrequent // and hence friendly to branch prediction.