-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
For the span I can use the Unsafe methods to get the correct ref and avoid any bounds checks. The memory is more complex, we end up with exactly the same overloads for the internal unsafe constructor and the external one. Flipping the parameters is a way to get around them unless someone else has a better idea? |
/// <param name="start">The index at which to begin the span.</param> | ||
/// <param name="length">The number of items in the span.</param> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static Memory<T> DangerousCreateMemory<T>(T[] array, int start, int length) => new Memory<T>(start, length, array); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approved APIs do not have Dangerous in names...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot that got removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I do not see APIs like these in the approved list. Where did these exact APIs got approved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically there are two API Reviewed Issues that have been approved that converge on this single type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have not noticed this API review. I do not think that the approved APIs are good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will hold off until that discussion has been had over there.
Closed, as other changes are being made here and currently tied up with SslStream |
Just a start to check approach is correct.