This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Commit 016659c
SpanHelpers IndexOfAny-methods use sentinel-value (#25970)
* SpanHelpers IndexOfAny-methods use sentinel-value
Instead of having _valueLength_-times an if-check in the loop,
a sentinel value is used and hence only one final checks needs to done.
Perf-win depends on the size of _valueLength_, the greater the more win.
* LastIndexOf initializes index with -1 instead of int.MinValue
As of PR-feedback.
* Better checks based on if instead of ternary operator
As of PR-feedback.
* SpanHelpers.byte.cs IndexOfAny can avoid int.MaxValue due to unit-trick
As of PR-Feedback1 parent c9eb1e3 commit 016659c
File tree
2 files changed
+3
-12
lines changed- src/System.Memory/src/System
2 files changed
+3
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 66 | + | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
| |||
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 84 | + | |
91 | 85 | | |
92 | 86 | | |
93 | 87 | | |
| |||
0 commit comments