changeset 29426:7c78e4589466

maint: Remove support for old_NA definition (pre-R compatible value). * oct-stream.cc (is_old_NA<T>, is_old_NA<double>, replace_old_NA<T>, replace_old_NA<double>): Remove templated functions. * oct-stream.cc (convert_and_capy): Remove check for is_old_NA() that calls replace_old_NA(). * data-conv.cc (read_doubles): Remove code to inspect each double value and call __lo_ieee_replace_old_NA(). * lo-ieee.h (__lo_ieee_is_old_NA, __lo_ieee_replace_old_NA): Delete forward declarations. * lo-ieee.cc (__lo_ieee_is_old_NA, __lo_ieee_replace_old_NA): Delete functions.
author Rik <rik@octave.org>
date Wed, 10 Mar 2021 16:35:59 -0800
parents 11a1e69e0035
children c850a9cd28f6
files libinterp/corefcn/oct-stream.cc liboctave/util/data-conv.cc liboctave/util/lo-ieee.cc liboctave/util/lo-ieee.h
diffstat 4 files changed, 14 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc	Wed Mar 10 11:46:50 2021 -0800
+++ b/libinterp/corefcn/oct-stream.cc	Wed Mar 10 16:35:59 2021 -0800
@@ -6338,36 +6338,6 @@
       m_rep->close ();
   }
 
-  // FIXME: maybe these should be defined in lo-ieee.h?
-
-  template <typename T>
-  static inline bool
-  is_old_NA (T)
-  {
-    return false;
-  }
-
-  template <>
-  inline bool
-  is_old_NA<double> (double val)
-  {
-    return __lo_ieee_is_old_NA (val);
-  }
-
-  template <typename T>
-  static inline T
-  replace_old_NA (T val)
-  {
-    return val;
-  }
-
-  template <>
-  inline double
-  replace_old_NA<double> (double val)
-  {
-    return __lo_ieee_replace_old_NA (val);
-  }
-
   template <typename SRC_T, typename DST_T>
   static octave_value
   convert_and_copy (std::list<void *>& input_buf_list,
@@ -6403,12 +6373,14 @@
                                                   1, from_flt_fmt,
                                                   mach_info::native_float_format ());
 
-                    dst_elt_type tmp (data[i]);
-
-                    if (is_old_NA (tmp))
-                      tmp = replace_old_NA (tmp);
-
-                    conv_data[j] = tmp;
+                    // FIXME: Potentially add conversion code for MIPS NA here
+                    //        Bug #59830.
+                    // dst_elt_type tmp (data[i]);
+                    // if (is_MIPS_NA (tmp))
+                    //  tmp = replace_MIPS_NA (tmp);
+                    // conv_data[j] = tmp;
+
+                    conv_data[j] = data[i];
                   }
               }
             else
@@ -6434,12 +6406,8 @@
                 for (octave_idx_type i = 0; i < input_buf_elts && j < elts_read;
                      i++, j++)
                   {
-                    dst_elt_type tmp (data[i]);
-
-                    if (is_old_NA (tmp))
-                      tmp = replace_old_NA (tmp);
-
-                    conv_data[j] = tmp;
+                    // FIXME: Potentially add conversion code for MIPS NA here
+                    conv_data[j] = data[i];
                   }
               }
             else
--- a/liboctave/util/data-conv.cc	Wed Mar 10 11:46:50 2021 -0800
+++ b/liboctave/util/data-conv.cc	Wed Mar 10 16:35:59 2021 -0800
@@ -819,9 +819,10 @@
         std::streamsize n_bytes = 8 * static_cast<std::streamsize> (len);
         is.read (reinterpret_cast<char *> (data), n_bytes);
         do_double_format_conversion (data, len, fmt);
-
-        for (int i = 0; i < len; i++)
-          data[i] = __lo_ieee_replace_old_NA (data[i]);
+        // FIXME: Potentially add conversion code for MIPS NA here, Bug #59830.
+        //
+        // for (int i = 0; i < len; i++)
+        //   data[i] = __lo_ieee_replace_MIPS_NA (data[i]);
       }
       break;
 
--- a/liboctave/util/lo-ieee.cc	Wed Mar 10 11:46:50 2021 -0800
+++ b/liboctave/util/lo-ieee.cc	Wed Mar 10 16:35:59 2021 -0800
@@ -56,24 +56,6 @@
           && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0;
 }
 
-int
-__lo_ieee_is_old_NA (double x)
-{
-  lo_ieee_double t;
-  t.value = x;
-  return (__lo_ieee_isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD
-          && t.word[lo_ieee_hw] == LO_IEEE_NA_HW_OLD) ? 1 : 0;
-}
-
-double
-__lo_ieee_replace_old_NA (double x)
-{
-  if (__lo_ieee_is_old_NA (x))
-    return lo_ieee_na_value ();
-  else
-    return x;
-}
-
 double
 lo_ieee_inf_value (void)
 {
--- a/liboctave/util/lo-ieee.h	Wed Mar 10 11:46:50 2021 -0800
+++ b/liboctave/util/lo-ieee.h	Wed Mar 10 16:35:59 2021 -0800
@@ -84,8 +84,6 @@
 inline int __lo_ieee_isinf (double x) { return std::isinf (x); }
 
 extern OCTAVE_API int __lo_ieee_is_NA (double);
-extern OCTAVE_API int __lo_ieee_is_old_NA (double);
-extern OCTAVE_API double __lo_ieee_replace_old_NA (double);
 
 extern OCTAVE_API double lo_ieee_inf_value (void);
 extern OCTAVE_API double lo_ieee_na_value (void);