# HG changeset patch # User jwe # Date 1095958873 0 # Node ID 1ec26bdb120ccd2736007e498a79ba87cb77e4bb # Parent 4e4062bb980739d73debbefc08eeebd62c341c11 [project @ 2004-09-23 16:58:57 by jwe] diff -r 4e4062bb9807 -r 1ec26bdb120c liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Sep 23 14:46:17 2004 +0000 +++ b/liboctave/ChangeLog Thu Sep 23 17:01:13 2004 +0000 @@ -1,3 +1,8 @@ +2004-09-23 David Bateman + + * oct-inttypes.h (OCTAVE_INT_DOUBLE_CMP_OP, OCTAVE_DOUBLE_INT_CMP_OP): + New macros. Use them to define mixed intX-double and double-intX ops. + 2004-09-22 Federico Zenith * DASPK-opts.in, DASRT-opts.in, ODESSA-opts.in: diff -r 4e4062bb9807 -r 1ec26bdb120c liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Thu Sep 23 14:46:17 2004 +0000 +++ b/liboctave/oct-inttypes.h Thu Sep 23 17:01:13 2004 +0000 @@ -462,6 +462,38 @@ OCTAVE_DOUBLE_INT_BIN_OP(*) OCTAVE_DOUBLE_INT_BIN_OP(/) +#define OCTAVE_INT_DOUBLE_CMP_OP(OP) \ + template \ + bool \ + operator OP (const octave_int& x, const double& y) \ + { \ + double tx = static_cast (x.value ()); \ + return tx OP y.value (); \ + } + +OCTAVE_INT_DOUBLE_CMP_OP (<) +OCTAVE_INT_DOUBLE_CMP_OP (<=) +OCTAVE_INT_DOUBLE_CMP_OP (>=) +OCTAVE_INT_DOUBLE_CMP_OP (>) +OCTAVE_INT_DOUBLE_CMP_OP (==) +OCTAVE_INT_DOUBLE_CMP_OP (!=) + +#define OCTAVE_DOUBLE_INT_CMP_OP(OP) \ + template \ + bool \ + operator OP (const double& x, const octave_int& y) \ + { \ + double ty = static_cast (y.value ()); \ + return y.value () OP ty; \ + } + +OCTAVE_DOUBLE_INT_CMP_OP (<) +OCTAVE_DOUBLE_INT_CMP_OP (<=) +OCTAVE_DOUBLE_INT_CMP_OP (>=) +OCTAVE_DOUBLE_INT_CMP_OP (>) +OCTAVE_DOUBLE_INT_CMP_OP (==) +OCTAVE_DOUBLE_INT_CMP_OP (!=) + #define OCTAVE_INT_BITCMP_OP(OP) \ \ template \