Summary
Implement the missing runtime functionality for LongSpan<T>.
Required changes
Update src/LongSpan.cs so that LongSpan<T> can represent and expose a valid memory range.
- Add a constructor that initializes
_reference and Length.
- Add a bounds-checked indexer.
- Return indexed elements by using
Unsafe.Add(ref _reference, index).
- Preserve
IsEmpty as a check of Length.
Rationale
The current type has no constructor or element accessor. _reference and Length therefore cannot be initialized for useful instances, and callers cannot access span elements.
Affected area
Acceptance criteria
LongSpan<T> initializes its reference and length through a public constructor.
- The indexer returns the element at a valid index.
- The indexer rejects indexes below zero and indexes greater than or equal to
Length.
IsEmpty remains true only when Length is zero.
Backlinks
Summary
Implement the missing runtime functionality for
LongSpan<T>.Required changes
Update
src/LongSpan.csso thatLongSpan<T>can represent and expose a valid memory range._referenceandLength.Unsafe.Add(ref _reference, index).IsEmptyas a check ofLength.Rationale
The current type has no constructor or element accessor.
_referenceandLengththerefore cannot be initialized for useful instances, and callers cannot access span elements.Affected area
src/LongSpan.csAcceptance criteria
LongSpan<T>initializes its reference and length through a public constructor.Length.IsEmptyremains true only whenLengthis zero.Backlinks