Skip to content

Adjust the vector docs to use langword instead of cref to preserve generic type information where relevant #106561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public Vector2 Translation
/// <summary>Negates the specified matrix by multiplying all its values by -1.</summary>
/// <param name="value">The matrix to negate.</param>
/// <returns>The negated matrix.</returns>
/// <altmember cref="Negate(Matrix3x2)"/>
/// <altmember cref="Negate(Matrix3x2)" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Matrix3x2 operator -(Matrix3x2 value)
=> (-value.AsImpl()).AsM3x2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public float this[int index]

/// <summary>Gets a value that indicates whether the current instance is the identity quaternion.</summary>
/// <value><see langword="true" /> if the current instance is the identity quaternion; otherwise, <see langword="false" />.</value>
/// <altmember cref="Identity"/>
/// <altmember cref="Identity" />
public readonly bool IsIdentity => this == Identity;

/// <summary>Adds each element in one quaternion with its corresponding element in a second quaternion.</summary>
Expand Down
176 changes: 88 additions & 88 deletions src/libraries/System.Private.CoreLib/src/System/Numerics/Vector.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -692,14 +692,14 @@ public readonly bool TryCopyTo(Span<float> destination)

/// <summary>Returns the length of the vector.</summary>
/// <returns>The vector's length.</returns>
/// <altmember cref="LengthSquared"/>
/// <altmember cref="LengthSquared" />
[Intrinsic]
public readonly float Length() => float.Sqrt(LengthSquared());

/// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
/// <remarks>This operation offers better performance than a call to the <see cref="Length" /> method.</remarks>
/// <altmember cref="Length"/>
/// <altmember cref="Length" />
[Intrinsic]
public readonly float LengthSquared() => Dot(this, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,14 +725,14 @@ public readonly bool TryCopyTo(Span<float> destination)

/// <summary>Returns the length of this vector object.</summary>
/// <returns>The vector's length.</returns>
/// <altmember cref="LengthSquared"/>
/// <altmember cref="LengthSquared" />
[Intrinsic]
public readonly float Length() => float.Sqrt(LengthSquared());

/// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
/// <remarks>This operation offers better performance than a call to the <see cref="Length" /> method.</remarks>
/// <altmember cref="Length"/>
/// <altmember cref="Length" />
[Intrinsic]
public readonly float LengthSquared() => Dot(this, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,14 +723,14 @@ public static Vector4 Transform(Vector4 value, Quaternion rotation)

/// <summary>Returns the length of this vector object.</summary>
/// <returns>The vector's length.</returns>
/// <altmember cref="LengthSquared"/>
/// <altmember cref="LengthSquared" />
[Intrinsic]
public readonly float Length() => float.Sqrt(LengthSquared());

/// <summary>Returns the length of the vector squared.</summary>
/// <returns>The vector's length squared.</returns>
/// <remarks>This operation offers better performance than a call to the <see cref="Length" /> method.</remarks>
/// <altmember cref="Length"/>
/// <altmember cref="Length" />
[Intrinsic]
public readonly float LengthSquared() => Dot(this, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public T this[int index]
/// <summary>Computes the bitwise-and of two vectors.</summary>
/// <param name="left">The vector to bitwise-and with <paramref name="right" />.</param>
/// <param name="right">The vector to bitwise-and with <paramref name="left" />.</param>
/// <returns>The bitwise-and of <paramref name="left" /> and <paramref name="right"/>.</returns>
/// <returns>The bitwise-and of <paramref name="left" /> and <paramref name="right" />.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> operator &(Vector<T> left, Vector<T> right)
Expand All @@ -266,7 +266,7 @@ public T this[int index]
/// <summary>Computes the bitwise-or of two vectors.</summary>
/// <param name="left">The vector to bitwise-or with <paramref name="right" />.</param>
/// <param name="right">The vector to bitwise-or with <paramref name="left" />.</param>
/// <returns>The bitwise-or of <paramref name="left" /> and <paramref name="right"/>.</returns>
/// <returns>The bitwise-or of <paramref name="left" /> and <paramref name="right" />.</returns>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector<T> operator |(Vector<T> left, Vector<T> right)
Expand Down Expand Up @@ -365,90 +365,90 @@ public T this[int index]
return result.As<ulong, T>();
}

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Byte}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Byte&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Byte}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Byte&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<byte>(Vector<T> value) => value.As<T, byte>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Double}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Double&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Double}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Double&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<double>(Vector<T> value) => value.As<T, double>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Int16}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Int16&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Int16}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Int16&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<short>(Vector<T> value) => value.As<T, short>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Int32}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Int32&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Int32}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Int32&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<int>(Vector<T> value) => value.As<T, int>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Int64}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Int64&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Int64}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Int64&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<long>(Vector<T> value) => value.As<T, long>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{IntPtr}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;IntPtr&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{IntPtr}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;IntPtr&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<nint>(Vector<T> value) => value.As<T, nint>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{UIntPtr}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;UIntPtr&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{UIntPtr}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;UIntPtr&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
[CLSCompliant(false)]
public static explicit operator Vector<nuint>(Vector<T> value) => value.As<T, nuint>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{SByte}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;SByte&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{SByte}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;SByte&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
[CLSCompliant(false)]
public static explicit operator Vector<sbyte>(Vector<T> value) => value.As<T, sbyte>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{Single}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;Single&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{Single}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;Single&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
public static explicit operator Vector<float>(Vector<T> value) => value.As<T, float>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{UInt16}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;UInt16&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{UInt16}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;UInt16&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
[CLSCompliant(false)]
public static explicit operator Vector<ushort>(Vector<T> value) => value.As<T, ushort>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{UInt32}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;UInt32&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{UInt32}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;UInt32&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
[CLSCompliant(false)]
public static explicit operator Vector<uint>(Vector<T> value) => value.As<T, uint>();

/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see cref="Vector{UInt64}" />.</summary>
/// <summary>Reinterprets a <see cref="Vector{T}" /> as a new <see langword="Vector&lt;UInt64&gt;" />.</summary>
/// <param name="value">The vector to reinterpret.</param>
/// <returns><paramref name="value" /> reinterpreted as a new <see cref="Vector{UInt64}" />.</returns>
/// <returns><paramref name="value" /> reinterpreted as a new <see langword="Vector&lt;UInt64&gt;" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="value" /> (<typeparamref name="T" />) is not supported.</exception>
[Intrinsic]
[CLSCompliant(false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ internal unsafe interface ISimdVector<TSelf, T>
/// <summary>Computes the bitwise-and of two vectors.</summary>
/// <param name="left">The vector to bitwise-and with <paramref name="right" />.</param>
/// <param name="right">The vector to bitwise-and with <paramref name="left" />.</param>
/// <returns>The bitwise-and of <paramref name="left" /> and <paramref name="right"/>.</returns>
/// <returns>The bitwise-and of <paramref name="left" /> and <paramref name="right" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
static virtual TSelf BitwiseAnd(TSelf left, TSelf right) => left & right;

/// <summary>Computes the bitwise-or of two vectors.</summary>
/// <param name="left">The vector to bitwise-or with <paramref name="right" />.</param>
/// <param name="right">The vector to bitwise-or with <paramref name="left" />.</param>
/// <returns>The bitwise-or of <paramref name="left" /> and <paramref name="right"/>.</returns>
/// <returns>The bitwise-or of <paramref name="left" /> and <paramref name="right" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
static virtual TSelf BitwiseOr(TSelf left, TSelf right) => left | right;

Expand Down Expand Up @@ -520,24 +520,24 @@ static virtual TSelf LoadAligned(T* source)
/// <param name="left">The vector to multiply with <paramref name="right" />.</param>
/// <param name="right">The vector to multiply with <paramref name="left" />.</param>
/// <returns>The element-wise product of <paramref name="left" /> and <paramref name="right" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right"/> (<typeparamref name="T" />) is not supported.</exception>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
static virtual TSelf Multiply(TSelf left, TSelf right) => left * right;

/// <summary>Multiplies a vector by a scalar to compute their product.</summary>
/// <param name="left">The vector to multiply with <paramref name="right" />.</param>
/// <param name="right">The scalar to multiply with <paramref name="left" />.</param>
/// <returns>The product of <paramref name="left" /> and <paramref name="right" />.</returns>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right"/> (<typeparamref name="T" />) is not supported.</exception>
/// <exception cref="NotSupportedException">The type of <paramref name="left" /> and <paramref name="right" /> (<typeparamref name="T" />) is not supported.</exception>
static virtual TSelf Multiply(TSelf left, T right) => left * right;

/// <summary>Computes an estimate of (<paramref name="left"/> * <paramref name="right"/>) + <paramref name="addend"/>.</summary>
/// <summary>Computes an estimate of (<paramref name="left" /> * <paramref name="right" />) + <paramref name="addend" />.</summary>
/// <param name="left">The vector to be multiplied with <paramref name="right" />.</param>
/// <param name="right">The vector to be multiplied with <paramref name="left" />.</param>
/// <param name="addend">The vector to be added to the result of <paramref name="left" /> multiplied by <paramref name="right" />.</param>
/// <returns>An estimate of (<paramref name="left"/> * <paramref name="right"/>) + <paramref name="addend"/>.</returns>
/// <returns>An estimate of (<paramref name="left" /> * <paramref name="right" />) + <paramref name="addend" />.</returns>
/// <remarks>
/// <para>On hardware that natively supports <c>FusedMultiplyAdd</c>, this may return a result that was rounded as one ternary operation.</para>
/// <para>On hardware without specialized support, this may just return (<paramref name="left"/> * <paramref name="right"/>) + <paramref name="addend"/>.</para>
/// <para>On hardware without specialized support, this may just return (<paramref name="left" /> * <paramref name="right" />) + <paramref name="addend" />.</para>
/// </remarks>
static abstract TSelf MultiplyAddEstimate(TSelf left, TSelf right, TSelf addend);

Expand Down
Loading
Loading