-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fn fguv 32x32xn_rust
: Elide val
bounds checks, fixing a perf regr…
…ession (#560) This elides bounds checks from indexing with `val` by clipping the index to a valid one. Initially, I copied #558's approach, which uses `cmp::min(val, scaling.as_ref().len() - 1)`, and this removes 3 bounds checks. But since the scaling size is a `const` and is `1 << BD::SCALING_BITS`, we can just truncate the other bits with `&`, which avoids a `csel` and 2 more bounds checks.
- Loading branch information
Showing
2 changed files
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters