Mercurial > hg > octave-lyh
changeset 7763:0c6b4c7d7117
Treat bool as a scalar in the bit functions
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 06 May 2008 06:19:58 -0400 |
parents | 9c24ca8761f7 |
children | aaa808ed5d53 |
files | src/ChangeLog src/bitfcns.cc |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-05-06 David Bateman <dbateman@free.fr> + + * bitfcns.cc (BITOP): Treat octave_bool types and octave_scalar. + 2008-05-06 John W. Eaton <jwe@octave.org> * symtab.h (symbol_table::scope_id_cache): New class. Use it to
--- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -40,6 +40,7 @@ #include "ov-int8.h" #include "ov-scalar.h" #include "ov-re-mat.h" +#include "ov-bool.h" // FIXME -- could probably eliminate some code duplication by // clever use of templates. @@ -87,12 +88,18 @@ if (nargin == 2) \ { \ if ((args(0).class_name () == octave_scalar::static_class_name ()) \ - || (args(1).class_name () == octave_scalar::static_class_name ())) \ + || (args(0).class_name () == octave_bool::static_class_name ()) \ + || (args(1).class_name () == octave_scalar::static_class_name ()) \ + || (args(1).class_name () == octave_bool::static_class_name ())) \ { \ bool arg0_is_int = (args(0).class_name () != \ - octave_scalar::static_class_name ()); \ + octave_scalar::static_class_name () && \ + args(0).class_name () != \ + octave_bool::static_class_name ()); \ bool arg1_is_int = (args(1).class_name () != \ - octave_scalar::static_class_name ()); \ + octave_scalar::static_class_name () && \ + args(1).class_name () != \ + octave_bool::static_class_name ()); \ \ if (! (arg0_is_int || arg1_is_int)) \ { \