comparison liboctave/oct-inttypes.h @ 4963:573d23f9c9cf

[project @ 2004-09-03 15:43:29 by jwe]
author jwe
date Fri, 03 Sep 2004 15:43:30 +0000
parents 7a3a480e8645
children 269c3d6c0569
comparison
equal deleted inserted replaced
4962:0ab18cbe8b5f 4963:573d23f9c9cf
131 131
132 template <class T1, class T2> 132 template <class T1, class T2>
133 inline T2 133 inline T2
134 octave_int_fit_to_range (const T1& x, const T2& mn, const T2& mx) 134 octave_int_fit_to_range (const T1& x, const T2& mn, const T2& mx)
135 { 135 {
136 return (x > mx ? mx : (x < mn ? mn : static_cast<T2> (x))); 136 return (x > mx ? mx : (x < mn ? mn : T2 (x)));
137 } 137 }
138 138
139 // If X is unsigned and the new type is signed, then we only have to 139 // If X is unsigned and the new type is signed, then we only have to
140 // check the upper limit, but we should cast the maximum value of the 140 // check the upper limit, but we should cast the maximum value of the
141 // new type to an unsigned type before performing the comparison. 141 // new type to an unsigned type before performing the comparison.