From 455efbe88c3c86487de5224f6fd7cf38aaee2167 Mon Sep 17 00:00:00 2001 From: Maya Ogita Date: Fri, 10 Jul 2026 18:42:41 +0900 Subject: [PATCH] Fix size calculation of `xstepped_range` --- include/xtensor/views/xslice.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xtensor/views/xslice.hpp b/include/xtensor/views/xslice.hpp index d2142fb82..2de2d77a6 100644 --- a/include/xtensor/views/xslice.hpp +++ b/include/xtensor/views/xslice.hpp @@ -1059,7 +1059,7 @@ namespace xt , m_step(step) { size_type n = stop_val - start_val; - m_size = n / step + (((n < 0) ^ (step > 0)) && (n % step)); + m_size = std::max(n / step + (((n < 0) ^ (step > 0)) && (n % step)), size_type(0)); } template