Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve do_slice #575

Merged
merged 2 commits into from
Dec 15, 2018
Merged

Improve do_slice #575

merged 2 commits into from
Dec 15, 2018

Conversation

jturner314
Copy link
Member

This PR does two things:

  1. Avoid performing division when step.abs() == 1. This improves performance. (See slice performance #571.)
  2. Prevent overflow when calculating the new stride. This is a bug fix, and I think it's necessary for soundness.

For example, consider the case where the original axis length is `1`,
the original stride is `2`, and `step` is `isize::MAX`.
@bluss
Copy link
Member

bluss commented Dec 15, 2018

Nice!

@bluss bluss merged commit 55aca3b into rust-ndarray:master Dec 15, 2018
@jturner314 jturner314 deleted the improve-do-slice branch December 15, 2018 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants