# HG changeset patch # User Jaroslav Hajek # Date 1237814628 -3600 # Node ID 7e31df9a03347af359fedf8fa25cc9e79446edc1 # Parent 979d0492ff4054e3fa55289b952a4173b04ed388 simplify double->int conversion in indexing diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2009-03-23 Jaroslav Hajek + + * idx-vector.cc (convert_index(double,...)): Simplify. + 2009-03-21 Jaroslav Hajek * Array-d.cc: lo_ieee_isnan -> xisnan. diff --git a/liboctave/idx-vector.cc b/liboctave/idx-vector.cc --- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -182,18 +182,9 @@ inline octave_idx_type convert_index (double x, bool& conv_error, octave_idx_type& ext) { - octave_idx_type i; - if (xisnan (x) || xisinf (x)) - { - i = 0; - conv_error = true; - } - else - { - i = static_cast (x); - if (static_cast (i) != x) - conv_error = true; - } + octave_idx_type i = static_cast (x); + if (static_cast (i) != x) + conv_error = true; return convert_index (i, conv_error, ext); }