Mercurial > octave-nkf
changeset 16323:e769440b39db
provide int64 extractors for octave_value class
* ov.h (octave_value::int64_value, octave_value::uint64_value):
New functions.
* ov-base.h, ov-base.cc (octave_base_value::int64_value,
octave_base_value::uint64_value): New functions.
* ov.cc (octave_value::idx_type_value): Use int64_value if
USE_64_BIT_IDX_T is defined.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 16 Mar 2013 03:58:07 -0400 |
parents | 12fbd8d2662c |
children | c130939b0d1c |
files | libinterp/octave-value/ov-base.cc libinterp/octave-value/ov-base.h libinterp/octave-value/ov.cc libinterp/octave-value/ov.h |
diffstat | 4 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc Sat Mar 16 03:41:21 2013 -0400 +++ b/libinterp/octave-value/ov-base.cc Sat Mar 16 03:58:07 2013 -0400 @@ -484,6 +484,9 @@ INT_CONV_METHOD (long int, long) INT_CONV_METHOD (unsigned long int, ulong) +INT_CONV_METHOD (int64_t, int64) +INT_CONV_METHOD (uint64_t, uint64) + int octave_base_value::nint_value (bool frc_str_conv) const {
--- a/libinterp/octave-value/ov-base.h Sat Mar 16 03:41:21 2013 -0400 +++ b/libinterp/octave-value/ov-base.h Sat Mar 16 03:58:07 2013 -0400 @@ -461,6 +461,10 @@ virtual unsigned long int ulong_value (bool = false, bool = false) const; + virtual int64_t int64_value (bool = false, bool = false) const; + + virtual uint64_t uint64_value (bool = false, bool = false) const; + virtual double double_value (bool = false) const; virtual float float_value (bool = false) const;
--- a/libinterp/octave-value/ov.cc Sat Mar 16 03:41:21 2013 -0400 +++ b/libinterp/octave-value/ov.cc Sat Mar 16 03:58:07 2013 -0400 @@ -1540,12 +1540,10 @@ octave_idx_type octave_value::idx_type_value (bool req_int, bool frc_str_conv) const { -#if SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_LONG - return long_value (req_int, frc_str_conv); -#elif SIZEOF_OCTAVE_IDX_TYPE == SIZEOF_INT +#if defined (USE_64_BIT_IDX_T) + return int64_value (req_int, frc_str_conv); +#else return int_value (req_int, frc_str_conv); -#else -#error "no octave_value extractor for octave_idx_type" #endif }
--- a/libinterp/octave-value/ov.h Sat Mar 16 03:41:21 2013 -0400 +++ b/libinterp/octave-value/ov.h Sat Mar 16 03:58:07 2013 -0400 @@ -734,6 +734,14 @@ ulong_value (bool req_int = false, bool frc_str_conv = false) const { return rep->ulong_value (req_int, frc_str_conv); } + int64_t + int64_value (bool req_int = false, bool frc_str_conv = false) const + { return rep->int64_value (req_int, frc_str_conv); } + + uint64_t + uint64_value (bool req_int = false, bool frc_str_conv = false) const + { return rep->uint64_value (req_int, frc_str_conv); } + octave_idx_type idx_type_value (bool req_int = false, bool frc_str_conv = false) const;