# HG changeset patch # User John W. Eaton # Date 1363420687 14400 # Node ID e769440b39db04239941b5e8fd488d22f2fbcc28 # Parent 12fbd8d2662c3c3bc3eaa607c3203d96ced8e434 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. diff --git a/libinterp/octave-value/ov-base.cc b/libinterp/octave-value/ov-base.cc --- a/libinterp/octave-value/ov-base.cc +++ b/libinterp/octave-value/ov-base.cc @@ -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 { diff --git a/libinterp/octave-value/ov-base.h b/libinterp/octave-value/ov-base.h --- a/libinterp/octave-value/ov-base.h +++ b/libinterp/octave-value/ov-base.h @@ -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; diff --git a/libinterp/octave-value/ov.cc b/libinterp/octave-value/ov.cc --- a/libinterp/octave-value/ov.cc +++ b/libinterp/octave-value/ov.cc @@ -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 } diff --git a/libinterp/octave-value/ov.h b/libinterp/octave-value/ov.h --- a/libinterp/octave-value/ov.h +++ b/libinterp/octave-value/ov.h @@ -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;