Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change removes the undefined behaviour on firstOne method when used on an empty mask.
I did that for 2 reasons:
This change made a 5% speed improvement on my tests [1] on average. The code is a generic lower_bound using SIMD instructions and uses Vc.
I choose to return Mask::Size because will change the function return pattern just a little. Instead of return [0, Size), returns [0, Size]. One alternative is firstOne receive the default value for empty masks, I think the speedup should be the same.
[1] https://github.com/andrelrt/VcAlgo/blob/CodeMigration/include/VcAlgo/details/lower_bound.h