Mercurial > hg > octave-nkf
changeset 5828:22e23bee74c8
[project @ 2006-05-23 06:05:14 by jwe]
author | jwe |
---|---|
date | Tue, 23 May 2006 06:05:14 +0000 |
parents | 1fe78adb91bc |
children | 93785a1b0f97 |
files | ChangeLog configure.in liboctave/ChangeLog liboctave/Sparse.cc liboctave/data-conv.cc liboctave/data-conv.h liboctave/oct-inttypes.cc liboctave/oct-inttypes.h liboctave/oct-rand.cc liboctave/oct-types.h.in liboctave/randmtzig.h src/DLD-FUNCTIONS/getrusage.cc src/DLD-FUNCTIONS/sort.cc src/bitfcns.cc src/load-save.cc src/ls-mat4.cc src/ls-mat4.h src/ls-mat5.cc src/ls-oct-binary.cc src/ov-base-int.cc src/ov-base.h src/ov-bool-mat.cc src/ov-bool-sparse.cc src/ov-cell.cc src/ov-cx-mat.cc src/ov-cx-sparse.cc src/ov-fcn-handle.cc src/ov-fcn-inline.cc src/ov-list.cc src/ov-re-mat.cc src/ov-re-sparse.cc src/ov-str-mat.cc src/ov-struct.cc src/ov.h |
diffstat | 34 files changed, 473 insertions(+), 473 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-05-23 John W. Eaton <jwe@octave.org> + + * configure.in: Check for inttypes.h and stdint.h. + 2006-05-19 John W. Eaton <jwe@octave.org> * mk-opts.pl (emit_print_function, emit_options_function):
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.510 $) +AC_REVISION($Revision: 1.511 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1169,8 +1169,8 @@ ### C headers AC_CHECK_HEADERS(assert.h curses.h direct.h dlfcn.h fcntl.h float.h \ - floatingpoint.h grp.h ieeefp.h limits.h memory.h nan.h \ - ncurses.h poll.h pwd.h stdlib.h string.h sys/ioctl.h \ + floatingpoint.h grp.h ieeefp.h inttypes.h limits.h memory.h nan.h \ + ncurses.h poll.h pwd.h stdint.h stdlib.h string.h sys/ioctl.h \ sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \ sys/time.h sys/times.h sys/types.h sys/utsname.h termcap.h \ unistd.h varargs.h)
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,16 @@ +2006-05-23 John W. Eaton <jwe@octave.org> + + * oct-types.h.in: Include stdint.h or inttypes.h for integer + typedefs, or define them if those files are not available. + * oct-inttypes.h (octave_int8_t, octave_int16_t, octave_int32_t, + octave_int64_t, octave_uint8_t, octave_uint16_t, octave_uint32_t, + octave_uint64_t): Delete typedefs. Replace all uses of these + types with int8_t, int16_t, etc. + * data-conv.h (TWO_BYTE_INT, FOUR_BYTE_INT, EIGHT_BYTE_INT): + Delete definitions. Replace all uses of these macros with int8_t, + int16_t, etc. + * randmtzig.h: Delete integer typedefs. + 2006-05-18 John W. Eaton <jwe@octave.org> * EIG.cc (EIG::init): Trap Inf and NaN values here.
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -2011,16 +2011,16 @@ octave_idx_type lhs_len = lhs.numel (); octave_idx_type rhs_len = rhs.numel (); - unsigned EIGHT_BYTE_INT long_lhs_len = - static_cast<unsigned EIGHT_BYTE_INT> (lhs.rows ()) * - static_cast<unsigned EIGHT_BYTE_INT> (lhs.cols ()); - - unsigned EIGHT_BYTE_INT long_rhs_len = - static_cast<unsigned EIGHT_BYTE_INT> (rhs.rows ()) * - static_cast<unsigned EIGHT_BYTE_INT> (rhs.cols ()); - - if (long_rhs_len != static_cast<unsigned EIGHT_BYTE_INT>(rhs_len) || - long_lhs_len != static_cast<unsigned EIGHT_BYTE_INT>(lhs_len)) + uint64_t long_lhs_len = + static_cast<uint64_t> (lhs.rows ()) * + static_cast<uint64_t> (lhs.cols ()); + + uint64_t long_rhs_len = + static_cast<uint64_t> (rhs.rows ()) * + static_cast<uint64_t> (rhs.cols ()); + + if (long_rhs_len != static_cast<uint64_t>(rhs_len) || + long_lhs_len != static_cast<uint64_t>(lhs_len)) { (*current_liboctave_error_handler) ("A(I) = X: Matrix dimensions too large to ensure correct\n",
--- a/liboctave/data-conv.cc +++ b/liboctave/data-conv.cc @@ -1000,27 +1000,27 @@ switch (type) { case LS_U_CHAR: - LS_DO_READ (unsigned char, swap, data, 1, len, is); + LS_DO_READ (uint8_t, swap, data, 1, len, is); break; case LS_U_SHORT: - LS_DO_READ (unsigned TWO_BYTE_INT, swap, data, 2, len, is); + LS_DO_READ (uint16_t, swap, data, 2, len, is); break; case LS_U_INT: - LS_DO_READ (unsigned FOUR_BYTE_INT, swap, data, 4, len, is); + LS_DO_READ (uint32_t, swap, data, 4, len, is); break; case LS_CHAR: - LS_DO_READ (signed char, swap, data, 1, len, is); + LS_DO_READ (int8_t, swap, data, 1, len, is); break; case LS_SHORT: - LS_DO_READ (TWO_BYTE_INT, swap, data, 2, len, is); + LS_DO_READ (int16_t, swap, data, 2, len, is); break; case LS_INT: - LS_DO_READ (FOUR_BYTE_INT, swap, data, 4, len, is); + LS_DO_READ (int32_t, swap, data, 4, len, is); break; case LS_FLOAT: @@ -1050,27 +1050,27 @@ switch (type) { case LS_U_CHAR: - LS_DO_WRITE (unsigned char, data, 1, len, os); + LS_DO_WRITE (uint8_t, data, 1, len, os); break; case LS_U_SHORT: - LS_DO_WRITE (unsigned TWO_BYTE_INT, data, 2, len, os); + LS_DO_WRITE (uint16_t, data, 2, len, os); break; case LS_U_INT: - LS_DO_WRITE (unsigned FOUR_BYTE_INT, data, 4, len, os); + LS_DO_WRITE (uint32_t, data, 4, len, os); break; case LS_CHAR: - LS_DO_WRITE (signed char, data, 1, len, os); + LS_DO_WRITE (int8_t, data, 1, len, os); break; case LS_SHORT: - LS_DO_WRITE (TWO_BYTE_INT, data, 2, len, os); + LS_DO_WRITE (int16_t, data, 2, len, os); break; case LS_INT: - LS_DO_WRITE (FOUR_BYTE_INT, data, 4, len, os); + LS_DO_WRITE (int32_t, data, 4, len, os); break; case LS_FLOAT:
--- a/liboctave/data-conv.h +++ b/liboctave/data-conv.h @@ -28,38 +28,6 @@ #include "mach-info.h" -// Not all of the following are currently used. - -#if CHAR_BIT != 8 -#error "CHAR_BIT is not 8!" -#endif - -#if SIZEOF_SHORT == 2 -#define TWO_BYTE_INT short -#elif SIZEOF_INT == 2 -#define TWO_BYTE_INT int -#else -#error "No 2 byte integer type found!" -#endif - -#if SIZEOF_INT == 4 -#define FOUR_BYTE_INT int -#elif SIZEOF_LONG == 4 -#define FOUR_BYTE_INT long -#else -#error "No 4 byte integer type found!" -#endif - -#if SIZEOF_LONG == 8 -#define EIGHT_BYTE_INT long -#else -#if SIZEOF_LONG_LONG == 8 -// if `long long' is not implemented, then SIZEOF_LONG_LONG will be 0 -#define EIGHT_BYTE_INT long long -// if no 8 byte integer type is found, then EIGHT_BYTE_INT is not defined -#endif -#endif - class oct_data_conv {
--- a/liboctave/oct-inttypes.cc +++ b/liboctave/oct-inttypes.cc @@ -91,15 +91,15 @@ INSTANTIATE_DOUBLE_INT_CMP_OPS (T); \ INSTANTIATE_INT_BITCMP_OPS (T) -INSTANTIATE_INTTYPE (octave_int8_t); -INSTANTIATE_INTTYPE (octave_int16_t); -INSTANTIATE_INTTYPE (octave_int32_t); -INSTANTIATE_INTTYPE (octave_int64_t); +INSTANTIATE_INTTYPE (int8_t); +INSTANTIATE_INTTYPE (int16_t); +INSTANTIATE_INTTYPE (int32_t); +INSTANTIATE_INTTYPE (int64_t); -INSTANTIATE_INTTYPE (octave_uint8_t); -INSTANTIATE_INTTYPE (octave_uint16_t); -INSTANTIATE_INTTYPE (octave_uint32_t); -INSTANTIATE_INTTYPE (octave_uint64_t); +INSTANTIATE_INTTYPE (uint8_t); +INSTANTIATE_INTTYPE (uint16_t); +INSTANTIATE_INTTYPE (uint32_t); +INSTANTIATE_INTTYPE (uint64_t); #define INSTANTIATE_INTTYPE_BIN_OP(T1, T2, OP) \ template octave_int<octave_int_binop_traits<T1, T2>::TR> \ @@ -111,77 +111,77 @@ INSTANTIATE_INTTYPE_BIN_OP (T1, T2, *); \ INSTANTIATE_INTTYPE_BIN_OP (T1, T2, /) -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int8_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int8_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int16_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int16_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int32_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int32_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_int64_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (int64_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint8_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint8_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint16_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint16_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint32_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint32_t, uint64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_int8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_int16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_int32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_int64_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_uint8_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_uint16_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_uint32_t); -INSTANTIATE_INTTYPE_BIN_OPS (octave_uint64_t, octave_uint64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, int8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, int16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, int32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, int64_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, uint8_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, uint16_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, uint32_t); +INSTANTIATE_INTTYPE_BIN_OPS (uint64_t, uint64_t); #define INSTANTIATE_INTTYPE_SHIFT_OP(T, OP) \ template octave_int<T> operator OP (const octave_int<T>&, const int&) @@ -190,14 +190,14 @@ INSTANTIATE_INTTYPE_SHIFT_OP (T, <<); \ INSTANTIATE_INTTYPE_SHIFT_OP (T, >>) -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_int8_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_int16_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_int32_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_int64_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_uint8_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_uint16_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_uint32_t); -INSTANTIATE_INTTYPE_SHIFT_OPS (octave_uint64_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (int8_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (int16_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (int32_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (int64_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (uint8_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (uint16_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (uint32_t); +INSTANTIATE_INTTYPE_SHIFT_OPS (uint64_t); #define INSTANTIATE_OCTAVE_INT_CMP_OP(OP, T1, T2) \ template bool operator OP (const octave_int<T1>&, const octave_int<T2>&) @@ -210,77 +210,77 @@ INSTANTIATE_OCTAVE_INT_CMP_OP (==, T1, T2); \ INSTANTIATE_OCTAVE_INT_CMP_OP (!=, T1, T2) -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_uint16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_uint32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int8_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, uint16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, uint32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int8_t, uint64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_uint16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_uint32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int16_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, uint16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, uint32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int16_t, uint64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_uint16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_uint32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int32_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, uint16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, uint32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int32_t, uint64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_uint16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_uint32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_int64_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, uint16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, uint32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (int64_t, uint64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_uint16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_uint32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint8_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, uint16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, uint32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint8_t, uint64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_int8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_int16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_int32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_uint16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_uint32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint16_t, octave_uint64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, int8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, int16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, int32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, uint16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, uint32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint16_t, uint64_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_int8_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_int16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_int32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_uint16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_uint32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint32_t, octave_uint64_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, int8_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, int16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, int32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, uint16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, uint32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint32_t, uint64_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_int8_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_int16_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_int32_t); -// INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_int64_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_uint8_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_uint16_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_uint32_t); -INSTANTIATE_OCTAVE_INT_CMP_OPS (octave_uint64_t, octave_uint64_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, int8_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, int16_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, int32_t); +// INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, int64_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, uint8_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, uint16_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, uint32_t); +INSTANTIATE_OCTAVE_INT_CMP_OPS (uint64_t, uint64_t); // The following apply if the unsigned type is at least as wide as the // signed type (then we can cast postive signed values to the unsigned @@ -322,14 +322,14 @@ OCTAVE_US_TYPE1_CMP_OPS (UT, ST) \ OCTAVE_SU_TYPE1_CMP_OPS (ST, UT) -OCTAVE_TYPE1_CMP_OPS (octave_uint32_t, octave_int8_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint32_t, octave_int16_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint32_t, octave_int32_t) +OCTAVE_TYPE1_CMP_OPS (uint32_t, int8_t) +OCTAVE_TYPE1_CMP_OPS (uint32_t, int16_t) +OCTAVE_TYPE1_CMP_OPS (uint32_t, int32_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint64_t, octave_int8_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint64_t, octave_int16_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint64_t, octave_int32_t) -OCTAVE_TYPE1_CMP_OPS (octave_uint64_t, octave_int64_t) +OCTAVE_TYPE1_CMP_OPS (uint64_t, int8_t) +OCTAVE_TYPE1_CMP_OPS (uint64_t, int16_t) +OCTAVE_TYPE1_CMP_OPS (uint64_t, int32_t) +OCTAVE_TYPE1_CMP_OPS (uint64_t, int64_t) // The following apply if the signed type is wider than the unsigned // type (then we can cast unsigned values to the signed type and @@ -371,7 +371,7 @@ OCTAVE_US_TYPE2_CMP_OPS (UT, ST) \ OCTAVE_SU_TYPE2_CMP_OPS (ST, UT) -OCTAVE_TYPE2_CMP_OPS (octave_uint32_t, octave_int64_t) +OCTAVE_TYPE2_CMP_OPS (uint32_t, int64_t)
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -27,20 +27,10 @@ #include <limits> #include <iostream> -#include "data-conv.h" +#include "oct-types.h" #include "lo-ieee.h" #include "lo-mappers.h" -typedef signed char octave_int8_t; -typedef TWO_BYTE_INT octave_int16_t; -typedef FOUR_BYTE_INT octave_int32_t; -typedef EIGHT_BYTE_INT octave_int64_t; - -typedef unsigned char octave_uint8_t; -typedef unsigned TWO_BYTE_INT octave_uint16_t; -typedef unsigned FOUR_BYTE_INT octave_uint32_t; -typedef unsigned EIGHT_BYTE_INT octave_uint64_t; - template <class T1, class T2> class octave_int_binop_traits @@ -58,77 +48,77 @@ typedef T3 TR; \ } -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_int8_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_int16_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_int32_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_int64_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_uint8_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_uint16_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_uint32_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int8_t, octave_uint64_t, octave_int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, int8_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, int16_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, int32_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, int64_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, uint8_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, uint16_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, uint32_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (int8_t, uint64_t, int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_int8_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_int16_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_int32_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_int64_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_uint8_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_uint16_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_uint32_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int16_t, octave_uint64_t, octave_int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, int8_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, int16_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, int32_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, int64_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, uint8_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, uint16_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, uint32_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (int16_t, uint64_t, int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_int8_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_int16_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_int32_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_int64_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_uint8_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_uint16_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_uint32_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int32_t, octave_uint64_t, octave_int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, int8_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, int16_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, int32_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, int64_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, uint8_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, uint16_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, uint32_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (int32_t, uint64_t, int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_int8_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_int16_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_int32_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_int64_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_uint8_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_uint16_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_uint32_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_int64_t, octave_uint64_t, octave_int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, int8_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, int16_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, int32_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, int64_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, uint8_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, uint16_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, uint32_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (int64_t, uint64_t, int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_int8_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_int16_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_int32_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_int64_t, octave_int8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_uint8_t, octave_uint8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_uint16_t, octave_uint8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_uint32_t, octave_uint8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint8_t, octave_uint64_t, octave_uint8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, int8_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, int16_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, int32_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, int64_t, int8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, uint8_t, uint8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, uint16_t, uint8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, uint32_t, uint8_t); +OCTAVE_INT_BINOP_TRAIT (uint8_t, uint64_t, uint8_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_int8_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_int16_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_int32_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_int64_t, octave_int16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_uint8_t, octave_uint16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_uint16_t, octave_uint16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_uint32_t, octave_uint16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint16_t, octave_uint64_t, octave_uint16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, int8_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, int16_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, int32_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, int64_t, int16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, uint8_t, uint16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, uint16_t, uint16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, uint32_t, uint16_t); +OCTAVE_INT_BINOP_TRAIT (uint16_t, uint64_t, uint16_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_int8_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_int16_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_int32_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_int64_t, octave_int32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_uint8_t, octave_uint32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_uint16_t, octave_uint32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_uint32_t, octave_uint32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint32_t, octave_uint64_t, octave_uint32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, int8_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, int16_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, int32_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, int64_t, int32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, uint8_t, uint32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, uint16_t, uint32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, uint32_t, uint32_t); +OCTAVE_INT_BINOP_TRAIT (uint32_t, uint64_t, uint32_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_int8_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_int16_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_int32_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_int64_t, octave_int64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_uint8_t, octave_uint64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_uint16_t, octave_uint64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_uint32_t, octave_uint64_t); -OCTAVE_INT_BINOP_TRAIT (octave_uint64_t, octave_uint64_t, octave_uint64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, int8_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, int16_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, int32_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, int64_t, int64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, uint8_t, uint64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, uint16_t, uint64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, uint32_t, uint64_t); +OCTAVE_INT_BINOP_TRAIT (uint64_t, uint64_t, uint64_t); template <class T1, class T2> inline T2 @@ -397,15 +387,15 @@ return is; } -typedef octave_int<octave_int8_t> octave_int8; -typedef octave_int<octave_int16_t> octave_int16; -typedef octave_int<octave_int32_t> octave_int32; -typedef octave_int<octave_int64_t> octave_int64; +typedef octave_int<int8_t> octave_int8; +typedef octave_int<int16_t> octave_int16; +typedef octave_int<int32_t> octave_int32; +typedef octave_int<int64_t> octave_int64; -typedef octave_int<octave_uint8_t> octave_uint8; -typedef octave_int<octave_uint16_t> octave_uint16; -typedef octave_int<octave_uint32_t> octave_uint32; -typedef octave_int<octave_uint64_t> octave_uint64; +typedef octave_int<uint8_t> octave_uint8; +typedef octave_int<uint16_t> octave_uint16; +typedef octave_int<uint32_t> octave_uint32; +typedef octave_int<uint64_t> octave_uint64; #define OCTAVE_INT_BIN_OP(OP) \ template <class T1, class T2> \ @@ -582,14 +572,14 @@ OCTAVE_US_TYPE1_CMP_OP_DECLS (UT, ST) \ OCTAVE_SU_TYPE1_CMP_OP_DECLS (ST, UT) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint32_t, octave_int8_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint32_t, octave_int16_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint32_t, octave_int32_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint32_t, int8_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint32_t, int16_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint32_t, int32_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint64_t, octave_int8_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint64_t, octave_int16_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint64_t, octave_int32_t) -OCTAVE_TYPE1_CMP_OP_DECLS (octave_uint64_t, octave_int64_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint64_t, int8_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint64_t, int16_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint64_t, int32_t) +OCTAVE_TYPE1_CMP_OP_DECLS (uint64_t, int64_t) // The following apply if the signed type is wider than the unsigned // type (then we can cast unsigned values to the signed type and @@ -621,7 +611,7 @@ OCTAVE_US_TYPE2_CMP_OP_DECLS (UT, ST) \ OCTAVE_SU_TYPE2_CMP_OP_DECLS (ST, UT) -OCTAVE_TYPE2_CMP_OP_DECLS (octave_uint32_t, octave_int64_t) +OCTAVE_TYPE2_CMP_OP_DECLS (uint32_t, int64_t) #undef OCTAVE_INT_BINOP_TRAIT #undef OCTAVE_US_S_FTR
--- a/liboctave/oct-rand.cc +++ b/liboctave/oct-rand.cc @@ -177,7 +177,7 @@ new_initialized = true; } - OCTAVE_LOCAL_BUFFER (unsigned FOUR_BYTE_INT, tmp, MT_N + 1); + OCTAVE_LOCAL_BUFFER (uint32_t, tmp, MT_N + 1); oct_get_state (tmp); for (octave_idx_type i = 0; i <= MT_N; i++) s.elem (i) = static_cast<double>(tmp [i]); @@ -192,9 +192,9 @@ octave_idx_type len = s.length(); octave_idx_type n = len < MT_N + 1 ? len : MT_N + 1; - OCTAVE_LOCAL_BUFFER (unsigned FOUR_BYTE_INT, tmp, MT_N + 1); + OCTAVE_LOCAL_BUFFER (uint32_t, tmp, MT_N + 1); for (octave_idx_type i = 0; i < n; i++) - tmp[i] = static_cast<unsigned FOUR_BYTE_INT> (s.elem(i)); + tmp[i] = static_cast<uint32_t> (s.elem(i)); if (len == MT_N + 1 && tmp[MT_N] <= MT_N && tmp[MT_N] > 0) oct_set_state (tmp);
--- a/liboctave/oct-types.h.in +++ b/liboctave/oct-types.h.in @@ -26,6 +26,49 @@ typedef @OCTAVE_IDX_TYPE@ octave_idx_type; +#if defined (HAVE_STDINT_H) +#include <stdint.h> +#elif defined (HAVE_INTTYPES_H) +#include <inttypes.h> +#else + +#if CHAR_BIT == 8 +typedef signed char int8_t; +typedef unsigned char uint8_t; +#else +#error "CHAR_BIT is not 8!" +#endif + +#if SIZEOF_SHORT == 2 +typedef short int16_t; +typedef unsigned short uint16_t; +#elif SIZEOF_INT == 2 +typedef long int16_t; +typedef unsigned long uint16_t; +#else +#error "No 2 byte integer type found!" +#endif + +#if SIZEOF_INT == 4 +typedef int int32_t; +typedef unsigned int uint32_t; +#elif SIZEOF_LONG == 4 +typedef long int32_t; +typedef unsigned long uint32_t; +#else +#error "No 4 byte integer type found!" +#endif + +#if SIZEOF_LONG == 8 +typedef long int64_t; +typedef unsigned long uint64_t; +#elif SIZEOF_LONG_LONG == 8 +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif + +#endif + #endif /*
--- a/liboctave/randmtzig.h +++ b/liboctave/randmtzig.h @@ -54,26 +54,6 @@ extern "C" { #endif -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#else -#if SIZEOF_INT == 4 -typedef unsigned int uint32_t; -#elif SIZEOF_LONG == 4 -typedef unsigned long uint32_t; -#else -#error "No 4 byte integer type found!" -#endif - -#if SIZEOF_LONG == 8 -typedef unsigned long uint64_t; -#else -#if SIZEOF_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#endif -#endif -#endif - /* === Mersenne Twister === */ extern void oct_init_by_int (uint32_t s); extern void oct_init_by_array (uint32_t init_key[], int key_length);
--- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -201,12 +201,12 @@ FILETIME ftCreation, ftExit, ftUser, ftKernel; GetProcessTimes (hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser); - EIGHT_BYTE_INT itmp = *(reinterpret_cast<EIGHT_BYTE_INT *> (&ftUser)); + int64_t itmp = *(reinterpret_cast<int64_t *> (&ftUser)); tv_tmp.assign ("sec", static_cast<double> (itmp / 10000000U)); tv_tmp.assign ("usec", static_cast<double> (itmp % 10000000U) / 10.); m.assign ("utime", octave_value (tv_tmp)); - itmp = *(reinterpret_cast<EIGHT_BYTE_INT *> (&ftKernel)); + itmp = *(reinterpret_cast<int64_t *> (&ftKernel)); tv_tmp.assign ("sec", static_cast<double> (itmp / 10000000U)); tv_tmp.assign ("usec", static_cast<double> (itmp % 10000000U) / 10.); m.assign ("stime", octave_value (tv_tmp));
--- a/src/DLD-FUNCTIONS/sort.cc +++ b/src/DLD-FUNCTIONS/sort.cc @@ -240,60 +240,60 @@ // casting doubles as unsigned eight byte integers, and with a little // bit of magic we can automatically sort the NaN's correctly. -#if defined (HAVE_IEEE754_DATA_FORMAT) && defined (EIGHT_BYTE_INT) +#if defined (HAVE_IEEE754_DATA_FORMAT) -static inline unsigned EIGHT_BYTE_INT -FloatFlip (unsigned EIGHT_BYTE_INT f) +static inline uint64_t +FloatFlip (uint64_t f) { - unsigned EIGHT_BYTE_INT mask - = -static_cast<EIGHT_BYTE_INT>(f >> 63) | 0x8000000000000000ULL; + uint64_t mask + = -static_cast<int64_t>(f >> 63) | 0x8000000000000000ULL; return f ^ mask; } -static inline unsigned EIGHT_BYTE_INT -IFloatFlip (unsigned EIGHT_BYTE_INT f) +static inline uint64_t +IFloatFlip (uint64_t f) { - unsigned EIGHT_BYTE_INT mask = ((f >> 63) - 1) | 0x8000000000000000ULL; + uint64_t mask = ((f >> 63) - 1) | 0x8000000000000000ULL; return f ^ mask; } template <> bool -ascending_compare (unsigned EIGHT_BYTE_INT a, - unsigned EIGHT_BYTE_INT b) +ascending_compare (uint64_t a, + uint64_t b) { return (a < b); } template <> bool -ascending_compare (vec_index<unsigned EIGHT_BYTE_INT> *a, - vec_index<unsigned EIGHT_BYTE_INT> *b) +ascending_compare (vec_index<uint64_t> *a, + vec_index<uint64_t> *b) { return (a->vec < b->vec); } template <> bool -descending_compare (unsigned EIGHT_BYTE_INT a, - unsigned EIGHT_BYTE_INT b) +descending_compare (uint64_t a, + uint64_t b) { return (a > b); } template <> bool -descending_compare (vec_index<unsigned EIGHT_BYTE_INT> *a, - vec_index<unsigned EIGHT_BYTE_INT> *b) +descending_compare (vec_index<uint64_t> *a, + vec_index<uint64_t> *b) { return (a->vec > b->vec); } -template class octave_sort<unsigned EIGHT_BYTE_INT>; -template class vec_index<unsigned EIGHT_BYTE_INT>; -template class octave_sort<vec_index<unsigned EIGHT_BYTE_INT> *>; +template class octave_sort<uint64_t>; +template class vec_index<uint64_t>; +template class octave_sort<vec_index<uint64_t> *>; template <> octave_value @@ -314,9 +314,9 @@ double *v = m.fortran_vec (); - unsigned EIGHT_BYTE_INT *p = reinterpret_cast<unsigned EIGHT_BYTE_INT *> (v); + uint64_t *p = reinterpret_cast<uint64_t *> (v); - octave_sort<unsigned EIGHT_BYTE_INT> sort; + octave_sort<uint64_t> sort; if (mode == ASCENDING) sort.set_compare (ascending_compare); @@ -373,7 +373,7 @@ } else { - OCTAVE_LOCAL_BUFFER (unsigned EIGHT_BYTE_INT, vi, ns); + OCTAVE_LOCAL_BUFFER (uint64_t, vi, ns); for (octave_idx_type j = 0; j < iter; j++) { @@ -456,17 +456,17 @@ double *v = m.fortran_vec (); - unsigned EIGHT_BYTE_INT *p = reinterpret_cast<unsigned EIGHT_BYTE_INT *> (v); + uint64_t *p = reinterpret_cast<uint64_t *> (v); - octave_sort<vec_index<unsigned EIGHT_BYTE_INT> *> indexed_sort; + octave_sort<vec_index<uint64_t> *> indexed_sort; if (mode == ASCENDING) indexed_sort.set_compare (ascending_compare); else if (mode == DESCENDING) indexed_sort.set_compare (descending_compare); - OCTAVE_LOCAL_BUFFER (vec_index<unsigned EIGHT_BYTE_INT> *, vi, ns); - OCTAVE_LOCAL_BUFFER (vec_index<unsigned EIGHT_BYTE_INT>, vix, ns); + OCTAVE_LOCAL_BUFFER (vec_index<uint64_t> *, vi, ns); + OCTAVE_LOCAL_BUFFER (vec_index<uint64_t>, vix, ns); for (octave_idx_type i = 0; i < ns; i++) vi[i] = &vix[i];
--- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -288,15 +288,15 @@ BITOP (^, "bitxor"); } -static EIGHT_BYTE_INT -bitshift (double a, int n, EIGHT_BYTE_INT mask) +static int64_t +bitshift (double a, int n, int64_t mask) { if (n > 0) - return (static_cast<EIGHT_BYTE_INT> (a) << n) & mask; + return (static_cast<int64_t> (a) << n) & mask; else if (n < 0) - return (static_cast<EIGHT_BYTE_INT> (a) >> -n) & mask; + return (static_cast<int64_t> (a) >> -n) & mask; else - return static_cast<EIGHT_BYTE_INT> (a) & mask; + return static_cast<int64_t> (a) & mask; } // Note that the bitshift operators are undefined if shifted by more @@ -457,7 +457,7 @@ else if (cname == "double") { nbits = (nbits < 53 ? nbits : 53); - EIGHT_BYTE_INT mask = 0x1FFFFFFFFFFFFFLL; + int64_t mask = 0x1FFFFFFFFFFFFFLL; if (nbits < 53) mask = mask >> (53 - nbits); else if (nbits < 1) @@ -532,21 +532,21 @@ } if (cname == "uint8") - retval = octave_uint8 (std::numeric_limits<octave_uint8_t>::max ()); + retval = octave_uint8 (std::numeric_limits<uint8_t>::max ()); else if (cname == "uint16") - retval = octave_uint16 (std::numeric_limits<octave_uint16_t>::max ()); + retval = octave_uint16 (std::numeric_limits<uint16_t>::max ()); else if (cname == "uint32") - retval = octave_uint32 (std::numeric_limits<octave_uint32_t>::max ()); + retval = octave_uint32 (std::numeric_limits<uint32_t>::max ()); else if (cname == "uint64") - retval = octave_uint64 (std::numeric_limits<octave_uint64_t>::max ()); + retval = octave_uint64 (std::numeric_limits<uint64_t>::max ()); else if (cname == "int8") - retval = octave_int8 (std::numeric_limits<octave_int8_t>::max ()); + retval = octave_int8 (std::numeric_limits<int8_t>::max ()); else if (cname == "int16") - retval = octave_int16 (std::numeric_limits<octave_int16_t>::max ()); + retval = octave_int16 (std::numeric_limits<int16_t>::max ()); else if (cname == "int32") - retval = octave_int32 (std::numeric_limits<octave_int32_t>::max ()); + retval = octave_int32 (std::numeric_limits<int32_t>::max ()); else if (cname == "int64") - retval = octave_int64 (std::numeric_limits<octave_int64_t>::max ()); + retval = octave_int64 (std::numeric_limits<int64_t>::max ()); else error ("intmax: not defined for '%s' objects", cname.c_str ()); @@ -595,21 +595,21 @@ } if (cname == "uint8") - retval = octave_uint8 (std::numeric_limits<octave_uint8_t>::min ()); + retval = octave_uint8 (std::numeric_limits<uint8_t>::min ()); else if (cname == "uint16") - retval = octave_uint16 (std::numeric_limits<octave_uint16_t>::min()); + retval = octave_uint16 (std::numeric_limits<uint16_t>::min()); else if (cname == "uint32") - retval = octave_uint32 (std::numeric_limits<octave_uint32_t>::min ()); + retval = octave_uint32 (std::numeric_limits<uint32_t>::min ()); else if (cname == "uint64") - retval = octave_uint64 (std::numeric_limits<octave_uint64_t>::min ()); + retval = octave_uint64 (std::numeric_limits<uint64_t>::min ()); else if (cname == "int8") - retval = octave_int8 (std::numeric_limits<octave_int8_t>::min ()); + retval = octave_int8 (std::numeric_limits<int8_t>::min ()); else if (cname == "int16") - retval = octave_int16 (std::numeric_limits<octave_int16_t>::min ()); + retval = octave_int16 (std::numeric_limits<int16_t>::min ()); else if (cname == "int32") - retval = octave_int32 (std::numeric_limits<octave_int32_t>::min ()); + retval = octave_int32 (std::numeric_limits<int32_t>::min ()); else if (cname == "int64") - retval = octave_int64 (std::numeric_limits<octave_int64_t>::min ()); + retval = octave_int64 (std::numeric_limits<int64_t>::min ()); else error ("intmin: not defined for '%s' objects", cname.c_str ());
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -360,7 +360,7 @@ { file.seekg (0, std::ios::beg); - FOUR_BYTE_INT mopt, nr, nc, imag, len; + int32_t mopt, nr, nc, imag, len; int err = read_mat_file_header (file, swap, mopt, nr, nc, imag, len, 1); @@ -1208,7 +1208,7 @@ case LS_MAT7_BINARY: { char const * versionmagic; - TWO_BYTE_INT number = *(TWO_BYTE_INT *)"\x00\x01"; + int16_t number = *(int16_t *)"\x00\x01"; struct tm bdt; time_t now; char headertext[128];
--- a/src/ls-mat4.cc +++ b/src/ls-mat4.cc @@ -109,9 +109,9 @@ } int -read_mat_file_header (std::istream& is, bool& swap, FOUR_BYTE_INT& mopt, - FOUR_BYTE_INT& nr, FOUR_BYTE_INT& nc, - FOUR_BYTE_INT& imag, FOUR_BYTE_INT& len, +read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, + int32_t& nr, int32_t& nc, + int32_t& imag, int32_t& len, int quiet) { swap = false; @@ -276,7 +276,7 @@ int mach = 0; int dlen = 0; - FOUR_BYTE_INT mopt, nr, nc, imag, len; + int32_t mopt, nr, nc, imag, len; int err = read_mat_file_header (is, swap, mopt, nr, nc, imag, len); if (err) @@ -389,7 +389,7 @@ save_mat_binary_data (std::ostream& os, const octave_value& tc, const std::string& name) { - FOUR_BYTE_INT mopt = 0; + int32_t mopt = 0; mopt += tc.is_string () ? 1 : 0; @@ -400,21 +400,21 @@ os.write (reinterpret_cast<char *> (&mopt), 4); - FOUR_BYTE_INT nr = tc.rows (); + int32_t nr = tc.rows (); os.write (reinterpret_cast<char *> (&nr), 4); - FOUR_BYTE_INT nc = tc.columns (); + int32_t nc = tc.columns (); os.write (reinterpret_cast<char *> (&nc), 4); octave_idx_type len = nr * nc; - FOUR_BYTE_INT imag = tc.is_complex_type () ? 1 : 0; + int32_t imag = tc.is_complex_type () ? 1 : 0; os.write (reinterpret_cast<char *> (&imag), 4); // LEN includes the terminating character, and the file is also // supposed to include it. - FOUR_BYTE_INT name_len = name.length () + 1; + int32_t name_len = name.length () + 1; os.write (reinterpret_cast<char *> (&name_len), 4); os << name << '\0';
--- a/src/ls-mat4.h +++ b/src/ls-mat4.h @@ -31,10 +31,9 @@ float_format_to_mopt_digit (oct_mach_info::float_format flt_fmt); extern int -read_mat_file_header (std::istream& is, bool& swap, FOUR_BYTE_INT& mopt, - FOUR_BYTE_INT& nr, FOUR_BYTE_INT& nc, - FOUR_BYTE_INT& imag, FOUR_BYTE_INT& len, - int quiet = 0); +read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, + int32_t& nr, int32_t& nc, int32_t& imag, + int32_t& len, int quiet = 0); extern std::string read_mat_binary_data (std::istream& is, const std::string& filename,
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -151,13 +151,13 @@ break; case miINT64: -#ifdef EIGHT_BYTE_INT +#ifdef int64_t read_doubles (is, data, LS_LONG, count, swap, flt_fmt); #endif break; case miUINT64: -#ifdef EIGHT_BYTE_INT +#ifdef int64_t read_doubles (is, data, LS_U_LONG, count, swap, flt_fmt); #endif break; @@ -192,27 +192,27 @@ switch (type) { case miINT8: - READ_INTEGER_DATA (signed char, swap, m, 1, count, is); + READ_INTEGER_DATA (int8_t, swap, m, 1, count, is); break; case miUINT8: - READ_INTEGER_DATA (unsigned char, swap, m, 1, count, is); + READ_INTEGER_DATA (uint8_t, swap, m, 1, count, is); break; case miINT16: - READ_INTEGER_DATA (signed TWO_BYTE_INT, swap, m, 2, count, is); + READ_INTEGER_DATA (int16_t, swap, m, 2, count, is); break; case miUINT16: - READ_INTEGER_DATA (unsigned TWO_BYTE_INT, swap, m, 2, count, is); + READ_INTEGER_DATA (uint16_t, swap, m, 2, count, is); break; case miINT32: - READ_INTEGER_DATA (signed FOUR_BYTE_INT, swap, m, 4, count, is); + READ_INTEGER_DATA (int32_t, swap, m, 4, count, is); break; case miUINT32: - READ_INTEGER_DATA (unsigned FOUR_BYTE_INT, swap, m, 4, count, is); + READ_INTEGER_DATA (uint32_t, swap, m, 4, count, is); break; case miSINGLE: @@ -223,14 +223,14 @@ break; case miINT64: -#ifdef EIGHT_BYTE_INT - READ_INTEGER_DATA (signed EIGHT_BYTE_INT, swap, m, 8, count, is); +#ifdef int64_t + READ_INTEGER_DATA (int64_t, swap, m, 8, count, is); #endif break; case miUINT64: -#ifdef EIGHT_BYTE_INT - READ_INTEGER_DATA (unsigned EIGHT_BYTE_INT, swap, m, 8, count, is); +#ifdef int64_t + READ_INTEGER_DATA (uint64_t, swap, m, 8, count, is); #endif break; @@ -338,7 +338,7 @@ read_mat5_tag (std::istream& is, bool swap, int& type, int& bytes) { unsigned int upper; - FOUR_BYTE_INT temp; + int32_t temp; if (! is.read (reinterpret_cast<char *> (&temp), 4 )) goto data_read_error; @@ -370,7 +370,7 @@ } static void -read_int (std::istream& is, bool swap, FOUR_BYTE_INT& val) +read_int (std::istream& is, bool swap, int32_t& val) { is.read (reinterpret_cast<char *> (&val), 4); @@ -401,14 +401,14 @@ bool imag; bool logicalvar; enum arrayclasstype arrayclass; - FOUR_BYTE_INT nzmax; - FOUR_BYTE_INT flags; + int32_t nzmax; + int32_t flags; dim_vector dims; int len; int element_length; std::streampos pos; - TWO_BYTE_INT number; - number = *(TWO_BYTE_INT *)"\x00\x01"; + int16_t number; + number = *(int16_t *)"\x00\x01"; global = false; @@ -498,7 +498,7 @@ // dimensions array subelement { - FOUR_BYTE_INT dim_len; + int32_t dim_len; if (read_mat5_tag (is, swap, type, dim_len) || type != miINT32) { @@ -510,7 +510,7 @@ dims.resize (ndims); for (int i = 0; i < ndims; i++) { - FOUR_BYTE_INT n; + int32_t n; read_int (is, swap, n); dims(i) = n; } @@ -659,7 +659,7 @@ goto data_read_error; } - FOUR_BYTE_INT nnz = cidx[nc]; + int32_t nnz = cidx[nc]; NDArray re; if (imag) { @@ -718,9 +718,9 @@ case mxSTRUCT_CLASS: { Octave_map m; - FOUR_BYTE_INT fn_type; - FOUR_BYTE_INT fn_len; - FOUR_BYTE_INT field_name_length; + int32_t fn_type; + int32_t fn_len; + int32_t field_name_length; // field name length subelement -- actually the maximum length // of a field name. The Matlab docs promise this will always @@ -973,7 +973,7 @@ int read_mat5_binary_file_header (std::istream& is, bool& swap, bool quiet) { - TWO_BYTE_INT version=0, magic=0; + int16_t version=0, magic=0; is.seekg (124, std::ios::beg); is.read (reinterpret_cast<char *> (&version), 2); @@ -1003,7 +1003,7 @@ static int write_mat5_tag (std::ostream& is, int type, int bytes) { - FOUR_BYTE_INT temp; + int32_t temp; if (bytes <= 4) temp = (bytes << 16) + type; @@ -1084,40 +1084,40 @@ switch (st) { case LS_U_CHAR: - MAT5_DO_WRITE (unsigned char, data, nel, os); + MAT5_DO_WRITE (uint8_t, data, nel, os); break; case LS_U_SHORT: - MAT5_DO_WRITE (unsigned TWO_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (uint16_t, data, nel, os); break; case LS_U_INT: - MAT5_DO_WRITE (unsigned FOUR_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (uint32_t, data, nel, os); break; // provide for 64 bit ints, even though get_save_type does // not yet implement them -#ifdef EIGHT_BYTE_INT +#ifdef int64_t case LS_U_LONG: - MAT5_DO_WRITE (unsigned EIGHT_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (uint64_t, data, nel, os); break; #endif case LS_CHAR: - MAT5_DO_WRITE (signed char, data, nel, os); + MAT5_DO_WRITE (int8_t, data, nel, os); break; case LS_SHORT: - MAT5_DO_WRITE (TWO_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (int16_t, data, nel, os); break; case LS_INT: - MAT5_DO_WRITE (FOUR_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (int32_t, data, nel, os); break; -#ifdef EIGHT_BYTE_INT +#ifdef int64_t case LS_LONG: - MAT5_DO_WRITE (EIGHT_BYTE_INT, data, nel, os); + MAT5_DO_WRITE (int64_t, data, nel, os); break; #endif @@ -1456,8 +1456,8 @@ bool mark_as_global, bool mat7_format, bool save_as_floats, bool compressing) { - FOUR_BYTE_INT flags=0; - FOUR_BYTE_INT nnz=0; + int32_t flags=0; + int32_t nnz=0; std::streampos fixup, contin; std::string cname = tc.class_name (); int max_namelen = (mat7_format ? 63 : 31); @@ -1579,7 +1579,7 @@ for (int i = 0; i < nd; i++) { - FOUR_BYTE_INT n = dv(i); + int32_t n = dv(i); os.write (reinterpret_cast<char *> (&n), 4); } @@ -1615,7 +1615,7 @@ int len = nr*nc*2; int paddedlength = PAD (nr*nc*2); - OCTAVE_LOCAL_BUFFER (TWO_BYTE_INT, buf, nc*nr+3); + OCTAVE_LOCAL_BUFFER (int16_t, buf, nc*nr+3); write_mat5_tag (os, miUINT16, len); for (int i = 0; i < nr; i++) @@ -1753,7 +1753,7 @@ { char buf[64]; - FOUR_BYTE_INT maxfieldnamelength = max_namelen + 1; + int32_t maxfieldnamelength = max_namelen + 1; int fieldcnt = 0; for (Octave_map::const_iterator i = m.begin (); i != m.end (); i++)
--- a/src/ls-oct-binary.cc +++ b/src/ls-oct-binary.cc @@ -141,8 +141,8 @@ char tmp = 0; - FOUR_BYTE_INT name_len = 0; - FOUR_BYTE_INT doc_len = 0; + int32_t name_len = 0; + int32_t doc_len = 0; doc.resize (0); @@ -209,7 +209,7 @@ // FIXMEX // This is cruft, since its for a save type that is old. Maybe // this is taking backward compatability too far!! - FOUR_BYTE_INT len; + int32_t len; if (! is.read (reinterpret_cast<char *> (&len), 4)) goto data_read_error; if (swap) @@ -236,7 +236,7 @@ case 255: { // Read the saved variable type - FOUR_BYTE_INT len; + int32_t len; if (! is.read (reinterpret_cast<char *> (&len), 4)) goto data_read_error; if (swap) @@ -272,12 +272,12 @@ const std::string& name, const std::string& doc, bool mark_as_global, bool save_as_floats) { - FOUR_BYTE_INT name_len = name.length (); + int32_t name_len = name.length (); os.write (reinterpret_cast<char *> (&name_len), 4); os << name; - FOUR_BYTE_INT doc_len = doc.length (); + int32_t doc_len = doc.length (); os.write (reinterpret_cast<char *> (&doc_len), 4); os << doc; @@ -293,7 +293,7 @@ // Write the string corresponding to the octave_value type std::string typ = tc.type_name (); - FOUR_BYTE_INT len = typ.length (); + int32_t len = typ.length (); os.write (reinterpret_cast<char *> (&len), 4); const char *btmp = typ.data (); os.write (btmp, len);
--- a/src/ov-base-int.cc +++ b/src/ov-base-int.cc @@ -134,7 +134,7 @@ return false; // Use negative value for ndims to differentiate with old format!! - FOUR_BYTE_INT tmp = - d.length(); + int32_t tmp = - d.length(); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i=0; i < d.length (); i++) { @@ -152,7 +152,7 @@ octave_base_int_matrix<T>::load_binary (std::istream& is, bool swap, oct_mach_info::float_format ) { - FOUR_BYTE_INT mdims; + int32_t mdims; if (! is.read (reinterpret_cast<char *> (&mdims), 4)) return false; if (swap) @@ -161,7 +161,7 @@ return false; mdims = - mdims; - FOUR_BYTE_INT di; + int32_t di; dim_vector dv; dv.resize (mdims);
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -35,6 +35,7 @@ #endif #include "Range.h" +#include "data-conv.h" #include "mx-base.h" #include "str-vec.h"
--- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -282,7 +282,7 @@ return false; // Use negative value for ndims to differentiate with old format!! - FOUR_BYTE_INT tmp = - d.length(); + int32_t tmp = - d.length(); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) { @@ -307,7 +307,7 @@ octave_bool_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { - FOUR_BYTE_INT mdims; + int32_t mdims; if (! is.read (reinterpret_cast<char *> (&mdims), 4)) return false; if (swap) @@ -319,7 +319,7 @@ // negative to allow the positive value to be used for rows/cols for // backward compatibility mdims = - mdims; - FOUR_BYTE_INT di; + int32_t di; dim_vector dv; dv.resize (mdims);
--- a/src/ov-bool-sparse.cc +++ b/src/ov-bool-sparse.cc @@ -204,7 +204,7 @@ int nc = d(1); int nz = nzmax (); - FOUR_BYTE_INT itmp; + int32_t itmp; // Use negative value for ndims to be consistent with other formats itmp= -2; os.write (reinterpret_cast<char *> (&itmp), 4); @@ -248,7 +248,7 @@ octave_sparse_bool_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { - FOUR_BYTE_INT nz, nc, nr, tmp; + int32_t nz, nc, nr, tmp; if (! is.read (reinterpret_cast<char *> (&tmp), 4)) return false;
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -620,7 +620,7 @@ return false; // Use negative value for ndims - FOUR_BYTE_INT di = - d.length(); + int32_t di = - d.length(); os.write (reinterpret_cast<char *> (&di), 4); for (int i = 0; i < d.length (); i++) { @@ -650,7 +650,7 @@ oct_mach_info::float_format fmt) { bool success = true; - FOUR_BYTE_INT mdims; + int32_t mdims; if (! is.read (reinterpret_cast<char *> (&mdims), 4)) return false; if (swap) @@ -659,7 +659,7 @@ return false; mdims = -mdims; - FOUR_BYTE_INT di; + int32_t di; dim_vector dv; dv.resize (mdims);
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -382,7 +382,7 @@ return false; // Use negative value for ndims to differentiate with old format!! - FOUR_BYTE_INT tmp = - d.length(); + int32_t tmp = - d.length(); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) { @@ -421,7 +421,7 @@ oct_mach_info::float_format fmt) { char tmp; - FOUR_BYTE_INT mdims; + int32_t mdims; if (! is.read (reinterpret_cast<char *> (&mdims), 4)) return false; if (swap) @@ -429,7 +429,7 @@ if (mdims < 0) { mdims = - mdims; - FOUR_BYTE_INT di; + int32_t di; dim_vector dv; dv.resize (mdims); @@ -467,7 +467,7 @@ } else { - FOUR_BYTE_INT nr, nc; + int32_t nr, nc; nr = mdims; if (! is.read (reinterpret_cast<char *> (&nc), 4)) return false;
--- a/src/ov-cx-sparse.cc +++ b/src/ov-cx-sparse.cc @@ -214,7 +214,7 @@ int nc = d(1); int nz = nzmax (); - FOUR_BYTE_INT itmp; + int32_t itmp; // Use negative value for ndims to be consistent with other formats itmp= -2; os.write (reinterpret_cast<char *> (&itmp), 4); @@ -271,7 +271,7 @@ octave_sparse_complex_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { - FOUR_BYTE_INT nz, nc, nr, tmp; + int32_t nz, nc, nr, tmp; char ctmp; if (! is.read (reinterpret_cast<char *> (&tmp), 4))
--- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -215,7 +215,7 @@ bool octave_fcn_handle::save_binary (std::ostream& os, bool&) { - FOUR_BYTE_INT tmp = nm.length (); + int32_t tmp = nm.length (); os.write (reinterpret_cast<char *> (&tmp), 4); os.write (nm.c_str (), nm.length ()); if (nm == "@<anonymous>") @@ -234,7 +234,7 @@ octave_fcn_handle::load_binary (std::istream& is, bool swap, oct_mach_info::float_format) { - FOUR_BYTE_INT tmp; + int32_t tmp; if (! is.read (reinterpret_cast<char *> (&tmp), 4)) return false; if (swap)
--- a/src/ov-fcn-inline.cc +++ b/src/ov-fcn-inline.cc @@ -152,7 +152,7 @@ bool octave_fcn_inline::save_binary (std::ostream& os, bool&) { - FOUR_BYTE_INT tmp = ifargs.length (); + int32_t tmp = ifargs.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < ifargs.length (); i++) { @@ -173,7 +173,7 @@ octave_fcn_inline::load_binary (std::istream& is, bool swap, oct_mach_info::float_format) { - FOUR_BYTE_INT nargs; + int32_t nargs; if (! is.read (reinterpret_cast<char *> (&nargs), 4)) return false; if (swap) @@ -183,7 +183,7 @@ return false; else { - FOUR_BYTE_INT tmp; + int32_t tmp; ifargs.resize (nargs); for (int i = 0; i < nargs; i++) {
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -615,7 +615,7 @@ { octave_value_list lst = list_value (); - FOUR_BYTE_INT len = lst.length(); + int32_t len = lst.length(); os.write (reinterpret_cast<char *> (&len), 4); for (int i = 0; i < lst.length (); i++) @@ -641,7 +641,7 @@ octave_list::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { - FOUR_BYTE_INT len; + int32_t len; if (! is.read (reinterpret_cast<char *> (&len), 4)) return false; if (swap)
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -429,7 +429,7 @@ return false; // Use negative value for ndims to differentiate with old format!! - FOUR_BYTE_INT tmp = - d.length(); + int32_t tmp = - d.length(); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) { @@ -467,7 +467,7 @@ oct_mach_info::float_format fmt) { char tmp; - FOUR_BYTE_INT mdims; + int32_t mdims; if (! is.read (reinterpret_cast<char *> (&mdims), 4)) return false; if (swap) @@ -475,7 +475,7 @@ if (mdims < 0) { mdims = - mdims; - FOUR_BYTE_INT di; + int32_t di; dim_vector dv; dv.resize (mdims); @@ -512,7 +512,7 @@ } else { - FOUR_BYTE_INT nr, nc; + int32_t nr, nc; nr = mdims; if (! is.read (reinterpret_cast<char *> (&nc), 4)) return false;
--- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -256,7 +256,7 @@ int nc = d(1); int nz = nzmax (); - FOUR_BYTE_INT itmp; + int32_t itmp; // Use negative value for ndims to be consistent with other formats itmp= -2; os.write (reinterpret_cast<char *> (&itmp), 4); @@ -313,7 +313,7 @@ octave_sparse_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { - FOUR_BYTE_INT nz, nc, nr, tmp; + int32_t nz, nc, nr, tmp; char ctmp; if (! is.read (reinterpret_cast<char *> (&tmp), 4))
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -456,7 +456,7 @@ return false; // Use negative value for ndims to differentiate with old format!! - FOUR_BYTE_INT tmp = - d.length(); + int32_t tmp = - d.length(); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i=0; i < d.length (); i++) { @@ -473,7 +473,7 @@ octave_char_matrix_str::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { - FOUR_BYTE_INT elements; + int32_t elements; if (! is.read (reinterpret_cast<char *> (&elements), 4)) return false; if (swap) @@ -481,8 +481,8 @@ if (elements < 0) { - FOUR_BYTE_INT mdims = - elements; - FOUR_BYTE_INT di; + int32_t mdims = - elements; + int32_t di; dim_vector dv; dv.resize (mdims); @@ -521,7 +521,7 @@ int max_len = 0; for (int i = 0; i < elements; i++) { - FOUR_BYTE_INT len; + int32_t len; if (! is.read (reinterpret_cast<char *> (&len), 4)) return false; if (swap)
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -1107,7 +1107,7 @@ { Octave_map m = map_value (); - FOUR_BYTE_INT len = m.length(); + int32_t len = m.length(); os.write (reinterpret_cast<char *> (&len), 4); Octave_map::iterator i = m.begin (); @@ -1131,7 +1131,7 @@ oct_mach_info::float_format fmt) { bool success = true; - FOUR_BYTE_INT len; + int32_t len; if (! is.read (reinterpret_cast<char *> (&len), 4)) return false; if (swap)