changeset 29882:38c47f8f7cd6

allow int64 (-large_int) to work properly again (bug #45945) * op-mi.cc (oct_unop_unsigned_uminus, oct_unop_signed_uminus): Use scalar_ref() and conversion to uint64/int64 instead of uint64_scalar_value/int64_scalar_value to avoid conversion to double before converting to integer value.
author John W. Eaton <jwe@octave.org>
date Wed, 14 Jul 2021 16:20:22 -0400
parents 35155423c0ef
children 0bd113ec8c37
files libinterp/operators/op-mi.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/operators/op-mi.cc	Wed Jul 14 17:42:10 2021 +0200
+++ b/libinterp/operators/op-mi.cc	Wed Jul 14 16:20:22 2021 -0400
@@ -59,7 +59,9 @@
   // We are storing a uint64 value, so some fakery is needed here.
   // Is there a better way?
 
-  octave_uint64 val = v.uint64_scalar_value ();
+  // FIXME: Maybe there should also be octave_magic_int::as_TYPE_value
+  // functions?
+  octave_uint64 val (v.scalar_ref ());
 
   uint64_t ival = val.value ();
 
@@ -103,7 +105,9 @@
 {
   const octave_magic_int& v = dynamic_cast<const octave_magic_int&> (a);
 
-  octave_int64 val = v.int64_scalar_value ();
+  // FIXME: Maybe there should also be octave_magic_int::as_TYPE_value
+  // functions?
+  octave_int64 val (v.scalar_ref ());
 
   return octave_value (new octave_magic_int (-val));
 }