Mercurial > hg > octave-nkf
changeset 16313:6aafe87a3144
use int64_t for idx type if --enable-64
* configure.ac: Check for and use int64_t instead of long if
--enable-64.
(IDX_TYPE_LONG): Delete definion. Change all uses to check
USE_64_BIT_IDX_T instead.
* MArray-i.cc: Instantiate arrays of int64_t instead of long, but only
if USE_64_BIT_IDX_T is defined.
* acinclinde.m4 (OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER): Use int64_t
instead of long.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 15 Mar 2013 07:07:08 -0400 |
parents | 9c4ac8f25a8c |
children | 0723ea02dcdb |
files | configure.ac libinterp/dldfcn/amd.cc libinterp/dldfcn/ccolamd.cc libinterp/dldfcn/colamd.cc libinterp/dldfcn/dmperm.cc libinterp/dldfcn/symbfact.cc libinterp/interp-core/ls-hdf5.h liboctave/array/CSparse.cc liboctave/array/CSparse.h liboctave/array/MArray-i.cc liboctave/array/dSparse.cc liboctave/array/dSparse.h liboctave/numeric/SparseCmplxQR.h liboctave/numeric/SparseQR.h liboctave/numeric/sparse-base-chol.cc liboctave/util/oct-sparse.h m4/acinclude.m4 |
diffstat | 17 files changed, 38 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -243,17 +243,9 @@ AC_CHECK_SIZEOF([void *]) AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long]) + AC_CHECK_SIZEOF([int64_t]) if test $ac_cv_sizeof_void_p -eq 8; then - if test $ac_cv_sizeof_int -eq 8; then - OCTAVE_IDX_TYPE=int - elif test $ac_cv_sizeof_long -eq 8; then - OCTAVE_IDX_TYPE=long - AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long.]) - else - warn_64_bit="no suitable type found for octave_idx_type so disabling 64-bit features" - OCTAVE_CONFIGURE_WARNING([warn_64_bit]) - USE_64_BIT_IDX_T=no - fi + OCTAVE_IDX_TYPE=int64_t else warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features" OCTAVE_CONFIGURE_WARNING([warn_64_bit]) @@ -2749,7 +2741,7 @@ #endif #ifdef USE_64_BIT_IDX_T -#define SIZEOF_OCTAVE_IDX_TYPE 8 +#define SIZEOF_OCTAVE_IDX_TYPE SIZEOF_INT64_T #else #define SIZEOF_OCTAVE_IDX_TYPE SIZEOF_INT #endif @@ -2822,10 +2814,10 @@ /* oct-types.h */ +#include <stdint.h> + typedef OCTAVE_IDX_TYPE octave_idx_type; -#include <stdint.h> - /* Tag indicating Octave config.h has been included */ #define OCTAVE_CONFIG_INCLUDED 1 ])
--- a/libinterp/dldfcn/amd.cc +++ b/libinterp/dldfcn/amd.cc @@ -44,7 +44,7 @@ #include "oct-sparse.h" #include "oct-locbuf.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define AMD_NAME(name) amd_l ## name #else #define AMD_NAME(name) amd ## name
--- a/libinterp/dldfcn/ccolamd.cc +++ b/libinterp/dldfcn/ccolamd.cc @@ -43,7 +43,7 @@ #include "oct-sparse.h" #include "oct-locbuf.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define CCOLAMD_NAME(name) ccolamd_l ## name #define CSYMAMD_NAME(name) csymamd_l ## name #else
--- a/libinterp/dldfcn/colamd.cc +++ b/libinterp/dldfcn/colamd.cc @@ -44,7 +44,7 @@ #include "oct-sparse.h" #include "oct-locbuf.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define COLAMD_NAME(name) colamd_l ## name #define SYMAMD_NAME(name) symamd_l ## name #else
--- a/libinterp/dldfcn/dmperm.cc +++ b/libinterp/dldfcn/dmperm.cc @@ -37,7 +37,7 @@ #include "SparseQR.h" #include "SparseCmplxQR.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define CXSPARSE_NAME(name) cs_dl ## name #else #define CXSPARSE_NAME(name) cs_di ## name
--- a/libinterp/dldfcn/symbfact.cc +++ b/libinterp/dldfcn/symbfact.cc @@ -132,7 +132,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT;
--- a/libinterp/interp-core/ls-hdf5.h +++ b/libinterp/interp-core/ls-hdf5.h @@ -202,7 +202,7 @@ hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name, void *buf); -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define H5T_NATIVE_IDX H5T_NATIVE_LONG #else #define H5T_NATIVE_IDX H5T_NATIVE_INT
--- a/liboctave/array/CSparse.cc +++ b/liboctave/array/CSparse.cc @@ -5661,7 +5661,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -5904,7 +5904,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -5928,7 +5928,7 @@ B->packed = true; B->sorted = true; B->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T B->itype = CHOLMOD_LONG; #else B->itype = CHOLMOD_INT; @@ -6195,7 +6195,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6417,7 +6417,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6441,7 +6441,7 @@ B->packed = true; B->sorted = true; B->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T B->itype = CHOLMOD_LONG; #else B->itype = CHOLMOD_INT;
--- a/liboctave/array/CSparse.h +++ b/liboctave/array/CSparse.h @@ -513,7 +513,7 @@ SPARSE_FORWARD_DEFS (MSparse, SparseComplexMatrix, ComplexMatrix, Complex) -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define UMFPACK_ZNAME(name) umfpack_zl_ ## name #else #define UMFPACK_ZNAME(name) umfpack_zi_ ## name
--- a/liboctave/array/MArray-i.cc +++ b/liboctave/array/MArray-i.cc @@ -32,7 +32,9 @@ #include "MArray.cc" template class OCTAVE_API MArray<int>; -template class OCTAVE_API MArray<long>; +#ifdef USE_64_BIT_IDX_T +template class OCTAVE_API MArray<int64_t>; +#endif // Explicit instantiation, as this seems to be required by weird compilers // like MSVC. This should be harmless on other compilers. @@ -42,7 +44,9 @@ template long xmax<long> (long, long); INSTANTIATE_MARRAY_FRIENDS (int, OCTAVE_API) -INSTANTIATE_MARRAY_FRIENDS (long, OCTAVE_API) +#ifdef USE_64_BIT_IDX_T +INSTANTIATE_MARRAY_FRIENDS (int64_t, OCTAVE_API) +#endif template class OCTAVE_API MArray<octave_int8>; template class OCTAVE_API MArray<octave_int16>;
--- a/liboctave/array/dSparse.cc +++ b/liboctave/array/dSparse.cc @@ -5859,7 +5859,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6075,7 +6075,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6099,7 +6099,7 @@ B->packed = true; B->sorted = true; B->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T B->itype = CHOLMOD_LONG; #else B->itype = CHOLMOD_INT; @@ -6337,7 +6337,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6571,7 +6571,7 @@ A->packed = true; A->sorted = true; A->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T A->itype = CHOLMOD_LONG; #else A->itype = CHOLMOD_INT; @@ -6595,7 +6595,7 @@ B->packed = true; B->sorted = true; B->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T B->itype = CHOLMOD_LONG; #else B->itype = CHOLMOD_INT;
--- a/liboctave/array/dSparse.h +++ b/liboctave/array/dSparse.h @@ -469,7 +469,7 @@ SPARSE_FORWARD_DEFS (MSparse, SparseMatrix, Matrix, double) -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define UMFPACK_DNAME(name) umfpack_dl_ ## name #else #define UMFPACK_DNAME(name) umfpack_di_ ## name
--- a/liboctave/numeric/SparseCmplxQR.h +++ b/liboctave/numeric/SparseCmplxQR.h @@ -31,7 +31,7 @@ #include "CSparse.h" #include "oct-sparse.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define CXSPARSE_ZNAME(name) cs_cl ## name #else #define CXSPARSE_ZNAME(name) cs_ci ## name
--- a/liboctave/numeric/SparseQR.h +++ b/liboctave/numeric/SparseQR.h @@ -31,7 +31,7 @@ #include "CSparse.h" #include "oct-sparse.h" -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define CXSPARSE_DNAME(name) cs_dl ## name #else #define CXSPARSE_DNAME(name) cs_di ## name
--- a/liboctave/numeric/sparse-base-chol.cc +++ b/liboctave/numeric/sparse-base-chol.cc @@ -136,7 +136,7 @@ ac->packed = true; ac->sorted = true; ac->nz = 0; -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T ac->itype = CHOLMOD_LONG; #else ac->itype = CHOLMOD_INT;
--- a/liboctave/util/oct-sparse.h +++ b/liboctave/util/oct-sparse.h @@ -87,7 +87,7 @@ || defined (HAVE_UFSPARSE_CHOLMOD_H) \ || defined (HAVE_CHOLMOD_CHOLMOD_H) \ || defined (HAVE_CHOLMOD_H)) -#ifdef IDX_TYPE_LONG +#ifdef USE_64_BIT_IDX_T #define CHOLMOD_NAME(name) cholmod_l_ ## name #else #define CHOLMOD_NAME(name) cholmod_ ## name
--- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -861,13 +861,10 @@ LIBS="fintsize.$ac_objext $[]_AC_LANG_PREFIX[]LIBS" AC_LANG_PUSH(C) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ - #include <assert.h> ]], [[ + #include <assert.h> + #include <stdint.h> ]], [[ #ifdef USE_64_BIT_IDX_T - #if IDX_TYPE_LONG - typedef long octave_idx_type; - #else - typedef int octave_idx_type; - #endif + typedef int64_t octave_idx_type; #else typedef int octave_idx_type; #endif