# HG changeset patch # User John W. Eaton # Date 1217450218 14400 # Node ID f7f2d867c5235fe762677d1b1e3470ad6deeea13 # Parent a4acda9fc3e7e985d7e8e9c3699d5a8d8d7107e7 style fixes diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,9 +1,14 @@ +2008-07-30 John W. Eaton + + * oct-inttypes.h: Style fixes. + 2008-07-30 Jaroslav Hajek * oct-inttypes.h (octave_int::trunc_flag): New member static field. (octave_int::get_trunc_flag, octave_int::clear_trunc_flag): New member functions. - (octave_int::octave_int (const octave_int&)): set trunc_flag on truncation. + (octave_int::octave_int (const octave_int&)): set trunc_flag + on truncation. (SPECIALIZE_WIDENING_CONVERSION): New macro. (DECLARE_OCTAVE_INT_TYPENAME): New macro. diff --git a/liboctave/oct-inttypes.h b/liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -43,7 +43,7 @@ }; #define OCTAVE_INT_BINOP_TRAIT(T1, T2, T3) \ - template<> \ + template <> \ class octave_int_binop_traits \ { \ public: \ @@ -506,37 +506,40 @@ #define SPECIALIZE_WIDENING_CONVERSION(T1, T2) \ template <> template <> \ - inline octave_int::octave_int (T1 i) : ival (i) {} \ + inline octave_int::octave_int (T1 i) \ + : ival (i) { } \ + \ template <> template <> \ - inline octave_int::octave_int (const octave_int& i) : ival (i.value ()) {} + inline octave_int::octave_int (const octave_int& i) \ + : ival (i.value ()) { } -SPECIALIZE_WIDENING_CONVERSION(int8_t, int16_t) -SPECIALIZE_WIDENING_CONVERSION(int8_t, int32_t) -SPECIALIZE_WIDENING_CONVERSION(int8_t, int64_t) -SPECIALIZE_WIDENING_CONVERSION(int16_t, int32_t) -SPECIALIZE_WIDENING_CONVERSION(int16_t, int64_t) -SPECIALIZE_WIDENING_CONVERSION(int32_t, int64_t) -SPECIALIZE_WIDENING_CONVERSION(uint8_t, uint16_t) -SPECIALIZE_WIDENING_CONVERSION(uint8_t, uint32_t) -SPECIALIZE_WIDENING_CONVERSION(uint8_t, uint64_t) -SPECIALIZE_WIDENING_CONVERSION(uint16_t, uint32_t) -SPECIALIZE_WIDENING_CONVERSION(uint16_t, uint64_t) -SPECIALIZE_WIDENING_CONVERSION(uint32_t, uint64_t) +SPECIALIZE_WIDENING_CONVERSION (int8_t, int16_t) +SPECIALIZE_WIDENING_CONVERSION (int8_t, int32_t) +SPECIALIZE_WIDENING_CONVERSION (int8_t, int64_t) +SPECIALIZE_WIDENING_CONVERSION (int16_t, int32_t) +SPECIALIZE_WIDENING_CONVERSION (int16_t, int64_t) +SPECIALIZE_WIDENING_CONVERSION (int32_t, int64_t) +SPECIALIZE_WIDENING_CONVERSION (uint8_t, uint16_t) +SPECIALIZE_WIDENING_CONVERSION (uint8_t, uint32_t) +SPECIALIZE_WIDENING_CONVERSION (uint8_t, uint64_t) +SPECIALIZE_WIDENING_CONVERSION (uint16_t, uint32_t) +SPECIALIZE_WIDENING_CONVERSION (uint16_t, uint64_t) +SPECIALIZE_WIDENING_CONVERSION (uint32_t, uint64_t) // declare type names #define DECLARE_OCTAVE_INT_TYPENAME(TYPE, TYPENAME) \ - template<> \ + template <> \ inline const char * \ octave_int::type_name () { return TYPENAME; } -DECLARE_OCTAVE_INT_TYPENAME(int8_t, "int8") -DECLARE_OCTAVE_INT_TYPENAME(int16_t, "int16") -DECLARE_OCTAVE_INT_TYPENAME(int32_t, "int32") -DECLARE_OCTAVE_INT_TYPENAME(int64_t, "int64") -DECLARE_OCTAVE_INT_TYPENAME(uint8_t, "uint8") -DECLARE_OCTAVE_INT_TYPENAME(uint16_t, "uint16") -DECLARE_OCTAVE_INT_TYPENAME(uint32_t, "uint32") -DECLARE_OCTAVE_INT_TYPENAME(uint64_t, "uint64") +DECLARE_OCTAVE_INT_TYPENAME (int8_t, "int8") +DECLARE_OCTAVE_INT_TYPENAME (int16_t, "int16") +DECLARE_OCTAVE_INT_TYPENAME (int32_t, "int32") +DECLARE_OCTAVE_INT_TYPENAME (int64_t, "int64") +DECLARE_OCTAVE_INT_TYPENAME (uint8_t, "uint8") +DECLARE_OCTAVE_INT_TYPENAME (uint16_t, "uint16") +DECLARE_OCTAVE_INT_TYPENAME (uint32_t, "uint32") +DECLARE_OCTAVE_INT_TYPENAME (uint64_t, "uint64") typedef octave_int octave_int8; typedef octave_int octave_int16; @@ -559,9 +562,9 @@ return OCTAVE_INT_FIT_TO_RANGE2 (r, T1, T2); \ } -OCTAVE_INT_BIN_OP(+) -OCTAVE_INT_BIN_OP(-) -OCTAVE_INT_BIN_OP(*) +OCTAVE_INT_BIN_OP (+) +OCTAVE_INT_BIN_OP (-) +OCTAVE_INT_BIN_OP (*) template octave_int::TR> @@ -584,10 +587,10 @@ return OCTAVE_INT_FIT_TO_RANGE (r, T); \ } -OCTAVE_INT_DOUBLE_BIN_OP(+) -OCTAVE_INT_DOUBLE_BIN_OP(-) -OCTAVE_INT_DOUBLE_BIN_OP(*) -OCTAVE_INT_DOUBLE_BIN_OP(/) +OCTAVE_INT_DOUBLE_BIN_OP (+) +OCTAVE_INT_DOUBLE_BIN_OP (-) +OCTAVE_INT_DOUBLE_BIN_OP (*) +OCTAVE_INT_DOUBLE_BIN_OP (/) #define OCTAVE_DOUBLE_INT_BIN_OP(OP) \ template \ @@ -600,10 +603,10 @@ return OCTAVE_INT_FIT_TO_RANGE (r, T); \ } -OCTAVE_DOUBLE_INT_BIN_OP(+) -OCTAVE_DOUBLE_INT_BIN_OP(-) -OCTAVE_DOUBLE_INT_BIN_OP(*) -OCTAVE_DOUBLE_INT_BIN_OP(/) +OCTAVE_DOUBLE_INT_BIN_OP (+) +OCTAVE_DOUBLE_INT_BIN_OP (-) +OCTAVE_DOUBLE_INT_BIN_OP (*) +OCTAVE_DOUBLE_INT_BIN_OP (/) #define OCTAVE_INT_DOUBLE_CMP_OP(OP) \ template \ @@ -648,10 +651,10 @@ return OCTAVE_INT_FIT_TO_RANGE (r, T); \ } -OCTAVE_INT_FLOAT_BIN_OP(+) -OCTAVE_INT_FLOAT_BIN_OP(-) -OCTAVE_INT_FLOAT_BIN_OP(*) -OCTAVE_INT_FLOAT_BIN_OP(/) +OCTAVE_INT_FLOAT_BIN_OP (+) +OCTAVE_INT_FLOAT_BIN_OP (-) +OCTAVE_INT_FLOAT_BIN_OP (*) +OCTAVE_INT_FLOAT_BIN_OP (/) #define OCTAVE_FLOAT_INT_BIN_OP(OP) \ template \ @@ -664,10 +667,10 @@ return OCTAVE_INT_FIT_TO_RANGE (r, T); \ } -OCTAVE_FLOAT_INT_BIN_OP(+) -OCTAVE_FLOAT_INT_BIN_OP(-) -OCTAVE_FLOAT_INT_BIN_OP(*) -OCTAVE_FLOAT_INT_BIN_OP(/) +OCTAVE_FLOAT_INT_BIN_OP (+) +OCTAVE_FLOAT_INT_BIN_OP (-) +OCTAVE_FLOAT_INT_BIN_OP (*) +OCTAVE_FLOAT_INT_BIN_OP (/) #define OCTAVE_INT_FLOAT_CMP_OP(OP) \ template \ diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2008-07-30 John W. Eaton + * ov-intx.h, ov.cc: Style fixes. + * gripes.cc (gripe_truncated_conversion): Use the warning ID Octave:int-convert-overflow. diff --git a/src/ov-intx.h b/src/ov-intx.h --- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -69,19 +69,18 @@ private: - template - _int_matrix convert_gripe () const + template + IM convert_gripe () const { - typedef typename _int_matrix::element_type dest_el_type; + typedef typename IM::element_type dest_el_type; typedef OCTAVE_INT_NDARRAY_T::element_type src_el_type; dest_el_type::clear_trunc_flag (); - _int_matrix retval (matrix); + IM retval (matrix); if (dest_el_type::get_trunc_flag ()) { gripe_truncated_conversion (src_el_type::type_name (), dest_el_type::type_name ()); dest_el_type::clear_trunc_flag (); - } return retval; @@ -429,13 +428,13 @@ private: - template - _int_scalar convert_gripe () const + template + IS convert_gripe () const { - typedef _int_scalar dest_el_type; + typedef IS dest_el_type; typedef OCTAVE_INT_T src_el_type; dest_el_type::clear_trunc_flag (); - _int_scalar retval (scalar); + IS retval (scalar); if (dest_el_type::get_trunc_flag ()) { gripe_truncated_conversion (src_el_type::type_name (), diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -1350,19 +1350,19 @@ static Array convert_to_int_array (const Array >& A) { - Array O (A.dims ()); + Array retval (A.dims ()); octave_idx_type n = A.numel (); octave_int::clear_trunc_flag (); for (octave_idx_type i = 0; i < n; i++) - O.xelem (i) = octave_int (A.xelem (i)); + retval.xelem (i) = octave_int (A.xelem (i)); if (octave_int::get_trunc_flag ()) { gripe_truncated_conversion (octave_int::type_name (), "int"); octave_int::clear_trunc_flag (); } - return O; + return retval; } Array