Skip to content

Commit bf873e9

Browse files
committed
Fix size calculation of xstepped_range
1 parent 01798fa commit bf873e9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/xtensor/views/xslice.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ namespace xt
10591059
, m_step(step)
10601060
{
10611061
size_type n = stop_val - start_val;
1062-
m_size = n / step + (((n < 0) ^ (step > 0)) && (n % step));
1062+
m_size = (n > 0) ^ (step > 0) ? 0 : n / step + static_cast<bool>(n % step);
10631063
}
10641064

10651065
template <class T>

0 commit comments

Comments
 (0)