Mercurial > octave
changeset 25682:54e79a3785d7
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 26 Jul 2018 15:32:52 -0400 |
parents | 4596a80cbc18 (current diff) bef21ac72618 (diff) |
children | f8ef00a58768 |
files | liboctave/util/module.mk liboctave/util/sun-utils.h |
diffstat | 4 files changed, 9 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/numeric/Quad.cc Thu Jul 26 11:34:09 2018 -0700 +++ b/liboctave/numeric/Quad.cc Thu Jul 26 15:32:52 2018 -0400 @@ -31,7 +31,6 @@ #include "f77-fcn.h" #include "lo-error.h" #include "quit.h" -#include "sun-utils.h" static integrand_fcn user_fcn; static float_integrand_fcn float_user_fcn; @@ -41,8 +40,8 @@ // function, and the user wants us to quit. int quad_integration_error = 0; -typedef F77_INT (*quad_fcn_ptr) (double*, int&, double*); -typedef F77_INT (*quad_float_fcn_ptr) (float*, int&, float*); +typedef F77_INT (*quad_fcn_ptr) (const double&, int&, double&); +typedef F77_INT (*quad_float_fcn_ptr) (const float&, int&, float&); extern "C" { @@ -80,25 +79,13 @@ } static F77_INT -user_function (double *x, int& ierr, double *result) +user_function (const double& x, int& ierr, double& result) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; -#if defined (__sparc) && defined (__GNUC__) - double xx = access_double (x); -#else - double xx = *x; -#endif - quad_integration_error = 0; - double xresult = (*user_fcn) (xx); - -#if defined (__sparc) && defined (__GNUC__) - assign_double (result, xresult); -#else - *result = xresult; -#endif + result = (*user_fcn) (x); if (quad_integration_error) ierr = -1; @@ -109,13 +96,13 @@ } static F77_INT -float_user_function (float *x, int& ierr, float *result) +float_user_function (const float& x, int& ierr, float& result) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; quad_integration_error = 0; - *result = (*float_user_fcn) (*x); + result = (*float_user_fcn) (x); if (quad_integration_error) ierr = -1;
--- a/liboctave/util/module.mk Thu Jul 26 11:34:09 2018 -0700 +++ b/liboctave/util/module.mk Thu Jul 26 15:32:52 2018 -0400 @@ -39,7 +39,6 @@ %reldir%/sparse-sort.h \ %reldir%/sparse-util.h \ %reldir%/str-vec.h \ - %reldir%/sun-utils.h \ %reldir%/unwind-prot.h \ %reldir%/url-transfer.h
--- a/liboctave/util/sun-utils.h Thu Jul 26 11:34:09 2018 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - -Copyright (C) 1993-2018 John W. Eaton - -This file is part of Octave. - -Octave is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -Octave is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<https://www.gnu.org/licenses/>. - -*/ - -#if ! defined (octave_sun_utils_h) -#define octave_sun_utils_h 1 - -#include "octave-config.h" - -// This is only needed to dereference pointers to doubles if mixing -// GCC and Sun SPARC f77/cc compiled code. See the GCC manual (where the -// function access_double() is described) and the Sun f77 manual, -// which explains that doubles are not always aligned on 8 byte -// boundaries. - -#if defined (__sparc) && defined (__GNUC__) - -inline double -access_double (double *unaligned_ptr) -{ - union d2i { double d; int i[2]; }; - - union d2i *p = (union d2i *) unaligned_ptr; - union d2i u; - - u.i[0] = p->i[0]; - u.i[1] = p->i[1]; - - return u.d; -} - -inline void -assign_double (double *unaligned_ptr, double value) -{ - union d2i { double d; int i[2]; }; - - double *ptr = &value; - union d2i *v = (union d2i *) ptr; - union d2i *p = (union d2i *) unaligned_ptr; - - p->i[0] = v->i[0]; - p->i[1] = v->i[1]; -} - -#endif -#endif
--- a/test/index.tst Thu Jul 26 11:34:09 2018 -0700 +++ b/test/index.tst Thu Jul 26 15:32:52 2018 -0400 @@ -501,7 +501,7 @@ %!error <index \(0\): subscripts must be> 1(0) %!error <index \(-1\): subscripts must be> 1(-1) %!error <index \(_,0.5\): subscripts> {}(1,0.5) -%!error <index \(nan,_\): subscripts> 1(NaN,1) +%!error <index \([Nn][aA][Nn],_\): subscripts> 1(NaN,1) %!error <index \(_,_,<cell....\[x8\]...\): subscripts> [](1,1,{},1,1,1,1,1,1,1,1) %!error <index \(...\[x9\]...-1,_\): subscript> 1(1,1,1,1,1,1,1,1,1,-1,1) %!error <index \(2\): out of bound 1> 1(2) @@ -547,8 +547,8 @@ %! ## Test permutation matrices %!shared abc %! abc = eye(3)([3 1 2],:); -%!error <abc\(nan\): subscripts> abc(NA) -%!error <abc\(_,_,_,inf,_\): subscripts> abc(1,1,1,Inf,1) +%!error <abc\([Nn][aA][Nn]\): subscripts> abc(NA) +%!error <abc\(_,_,_,[Ii][nN][Ff],_\): subscripts> abc(1,1,1,Inf,1) %! ## Test sparse matrices %!shared abc