Commit f644571
committed
feat(int64): add UnmanagedSpan extension methods for Span<T> parity
Implements Span<T>-equivalent extension methods for UnmanagedSpan<T>
and ReadOnlyUnmanagedSpan<T> with full long indexing support.
**Search Methods (return long)**
- IndexOf(T value) - first occurrence
- IndexOf(ReadOnlyUnmanagedSpan<T> value) - first sequence occurrence
- LastIndexOf(T value) - last occurrence
- LastIndexOf(ReadOnlyUnmanagedSpan<T> value) - last sequence occurrence
- IndexOfAny(T, T) / IndexOfAny(T, T, T) / IndexOfAny(span)
- LastIndexOfAny(T, T) / LastIndexOfAny(T, T, T) / LastIndexOfAny(span)
- BinarySearch(T) / BinarySearch(T, IComparer<T>)
**Predicates**
- Contains(T value) - existence check
- SequenceEqual(span) / SequenceEqual(span, comparer)
- StartsWith(span) / EndsWith(span)
**Sorting (IntroSort with long indices)**
- Sort() / Sort(IComparer<T>) / Sort(Comparison<T>)
- Sort(keys, items) - paired sort with values span
**Modification**
- Reverse() - in-place reversal
- Replace(oldValue, newValue) - in-place replacement
**Statistics**
- Count(T value) - occurrence count (returns long)
- CommonPrefixLength(span) - shared prefix length
All methods support >2B element spans via long indexing.1 parent 176336a commit f644571
2 files changed
Lines changed: 872 additions & 1 deletion
File tree
- src/NumSharp.Core
- Backends/Unmanaged
- Utilities/SpanSource
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
| |||
0 commit comments