# HG changeset patch # User John W. Eaton # Date 1205871670 14400 # Node ID a89b3fa632eea5051fedcb0fb5fca1ea0d41638a # Parent 6b2a99e44ff2a95186da61edf025a7477d3c4e0b partial specialization for octave_int_fit_to_range diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -5,8 +5,8 @@ 2008-03-18 John W. Eaton - * oct-inttypes.h (OCTAVE_DBL_FTR): New macro. - Use it to provide double specializations for octave_int_fit_to_range. + * oct-inttypes.h (octave_int_fit_to_range): + Use partial specialization for double values. 2008-03-08 John W. Eaton diff --git a/liboctave/oct-inttypes.h b/liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -128,26 +128,12 @@ return (x > mx ? mx : (x < mn ? mn : T2 (x))); } -#define OCTAVE_DBL_FTR(T) \ - template <> \ - inline T \ - octave_int_fit_to_range (const double& x, const T& mn, \ - const T& mx) \ - { \ - return (lo_ieee_isnan (x) ? 0 : (x > mx ? mx : (x < mn ? mn : static_cast (x)))); \ - } - -OCTAVE_DBL_FTR (char) -OCTAVE_DBL_FTR (short) -OCTAVE_DBL_FTR (int) -OCTAVE_DBL_FTR (long) -OCTAVE_DBL_FTR (long long) - -OCTAVE_DBL_FTR (unsigned char) -OCTAVE_DBL_FTR (unsigned short) -OCTAVE_DBL_FTR (unsigned int) -OCTAVE_DBL_FTR (unsigned long) -OCTAVE_DBL_FTR (unsigned long long) +template +inline T +octave_int_fit_to_range (const double& x, const T& mn, const T& mx) +{ + return (lo_ieee_isnan (x) ? 0 : (x > mx ? mx : (x < mn ? mn : static_cast (x)))); +} // If X is unsigned and the new type is signed, then we only have to // check the upper limit, but we should cast the maximum value of the