diff liboctave/util/lo-utils.cc @ 29445:b5f3ae7610cf

Use gnulib macros that account for the output type in integer overflow checks. * liboctave/wrappers/intprops-wrappers.c, intprops-wrappers.h: Use gnulib macro INT_MULTIPLY_WRAPV instead of INT_MULTIPLY_OVERFLOW. Change function prototypes accordingly * liboctave/util/lo-utils.cc, lo-utils.h (int_multiply_ok): Change function prototypes. * libinterp/dldfcn/__ode15__.cc (IDA::set_up): Adapt for changed function.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 16 Mar 2021 18:17:42 +0100
parents 7854d5752dd2
children da7210e30f3e
line wrap: on
line diff
--- a/liboctave/util/lo-utils.cc	Mon Mar 15 19:57:54 2021 +0100
+++ b/liboctave/util/lo-utils.cc	Tue Mar 16 18:17:42 2021 +0100
@@ -478,38 +478,42 @@
 
   namespace math
   {
-    bool int_multiply_overflow (int a, int b)
+    bool int_multiply_overflow (int a, int b, int *r)
     {
-      return octave_i_multiply_overflow_wrapper (a, b);
+      return octave_i_multiply_overflow_wrapper (a, b, r);
     }
 
-    bool int_multiply_overflow (long int a, long int b)
+    bool int_multiply_overflow (long int a, long int b, long int *r)
     {
-      return octave_li_multiply_overflow_wrapper (a, b);
+      return octave_li_multiply_overflow_wrapper (a, b, r);
     }
 
 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
-    bool int_multiply_overflow (long long int a, long long int b)
+    bool int_multiply_overflow (long long int a, long long int b,
+                                long long int *r)
     {
-      return octave_lli_multiply_overflow_wrapper (a, b);
+      return octave_lli_multiply_overflow_wrapper (a, b, r);
     }
 #endif
 
-    bool int_multiply_overflow (unsigned int a, unsigned int b)
+    bool int_multiply_overflow (unsigned int a, unsigned int b,
+                                unsigned int *r)
     {
-      return octave_ui_multiply_overflow_wrapper (a, b);
+      return octave_ui_multiply_overflow_wrapper (a, b, r);
     }
 
-    bool int_multiply_overflow (unsigned long int a, unsigned long int b)
+    bool int_multiply_overflow (unsigned long int a, unsigned long int b,
+                          unsigned long int *r)
     {
-      return octave_uli_multiply_overflow_wrapper (a, b);
+      return octave_uli_multiply_overflow_wrapper (a, b, r);
     }
 
 #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
     bool int_multiply_overflow (unsigned long long int a,
-                                unsigned long long int b)
+                          unsigned long long int b,
+                          unsigned long long int *r)
     {
-      return octave_ulli_multiply_overflow_wrapper (a, b);
+      return octave_ulli_multiply_overflow_wrapper (a, b, r);
     }
 #endif