# HG changeset patch # User John W. Eaton # Date 1403207354 14400 # Node ID ff4da3c8ed16603cd87b47a9a3c708c317e49d98 # Parent 161b11e7da2d337fdeb8b287a5c3777def7b9a36 use gnulib log2 modules (bug #42583) * bootstrap.conf (gnulib_modules): Include log2, log2f, log2-ieee, and log2f-ieee, in the list. * lo-mappers.cc (xlog2): Use gnulib:: versions of log2 and log2f. * CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc: Use xlog2. diff -r 161b11e7da2d -r ff4da3c8ed16 bootstrap.conf --- a/bootstrap.conf Thu Jun 19 09:41:12 2014 -0700 +++ b/bootstrap.conf Thu Jun 19 15:49:14 2014 -0400 @@ -50,6 +50,10 @@ isatty largefile link + log2 + log2-ieee + log2f + log2f-ieee lstat malloc-gnu mbrtowc diff -r 161b11e7da2d -r ff4da3c8ed16 liboctave/array/CMatrix.cc --- a/liboctave/array/CMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/CMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2683,11 +2683,8 @@ // call. double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2875,11 +2872,8 @@ // call. double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; diff -r 161b11e7da2d -r ff4da3c8ed16 liboctave/array/dMatrix.cc --- a/liboctave/array/dMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/dMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2320,11 +2320,8 @@ // of LAPACK does not return it on a query call. double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2511,11 +2508,8 @@ // of LAPACK does not return it on a query call. double dminmn = static_cast (minmn); double dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - double tmp = log2 (dminmn / dsmlsizp1); -#else - double tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + double tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; diff -r 161b11e7da2d -r ff4da3c8ed16 liboctave/array/fCMatrix.cc --- a/liboctave/array/fCMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/fCMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2699,11 +2699,8 @@ // call. float dminmn = static_cast (minmn); float dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2894,11 +2891,8 @@ // call. float dminmn = static_cast (minmn); float dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; diff -r 161b11e7da2d -r ff4da3c8ed16 liboctave/array/fMatrix.cc --- a/liboctave/array/fMatrix.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/array/fMatrix.cc Thu Jun 19 15:49:14 2014 -0400 @@ -2340,11 +2340,8 @@ // of LAPACK does not return it on a query call. float dminmn = static_cast (minmn); float dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; @@ -2531,11 +2528,8 @@ // of LAPACK does not return it on a query call. float dminmn = static_cast (minmn); float dsmlsizp1 = static_cast (smlsiz+1); -#if defined (HAVE_LOG2) - float tmp = log2 (dminmn / dsmlsizp1); -#else - float tmp = log (dminmn / dsmlsizp1) / log (2.0); -#endif + float tmp = xlog2 (dminmn / dsmlsizp1); + octave_idx_type nlvl = static_cast (tmp) + 1; if (nlvl < 0) nlvl = 0; diff -r 161b11e7da2d -r ff4da3c8ed16 liboctave/numeric/lo-mappers.cc --- a/liboctave/numeric/lo-mappers.cc Thu Jun 19 09:41:12 2014 -0700 +++ b/liboctave/numeric/lo-mappers.cc Thu Jun 19 15:49:14 2014 -0400 @@ -92,17 +92,7 @@ double xlog2 (double x) { -#if defined (HAVE_LOG2) - return log2 (x); -#else -#if defined (M_LN2) - static double ln2 = M_LN2; -#else - static double ln2 = log (2); -#endif - - return log (x) / ln2; -#endif + return gnulib::log2 (x); } Complex @@ -317,19 +307,7 @@ float xlog2 (float x) { -#if defined (HAVE_LOG2F) - return log2f (x); -#elif defined (HAVE_LOG2) - return log2 (x); -#else -#if defined (M_LN2) - static float ln2 = M_LN2; -#else - static float ln2 = log2 (2); -#endif - - return log (x) / ln2; -#endif + return gnulib::log2f (x); } FloatComplex