Mercurial > octave
changeset 31160:4efd735d034c
octave_int<T>: Overload operator ~ ().
* liboctave/util/oct-inttypes.h (octave_int<T>): Overload unary `operator ~`
(bitwise NOT) to correct result for octave_uint8.
See also: https://octave.discourse.group/t/3063
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 29 Jul 2022 15:43:20 +0200 |
parents | 731b6a5c7c4c |
children | 06c76eca5f95 |
files | liboctave/util/oct-inttypes.h |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/oct-inttypes.h Thu Jul 28 19:23:14 2022 -0400 +++ b/liboctave/util/oct-inttypes.h Fri Jul 29 15:43:20 2022 +0200 @@ -862,6 +862,12 @@ #undef OCTAVE_INT_UN_OP + octave_int<T> operator ~ (void) const + { + T bitinv = ~ m_ival; + return bitinv; + } + // Homogeneous binary integer operations. #define OCTAVE_INT_BIN_OP(OP, NAME, ARGT) \ inline octave_int<T> \