diff --git a/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs b/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs index bb7bd1d57d6948..7897a41ee6ce23 100644 --- a/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs +++ b/src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs @@ -55,7 +55,7 @@ namespace System.Buffers } namespace System.Numerics.Tensors { - public partial interface IReadOnlyTensor : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where TSelf : System.Numerics.Tensors.IReadOnlyTensor + public partial interface IReadOnlyTensor : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where TSelf : System.Numerics.Tensors.IReadOnlyTensor { static abstract TSelf? Empty { get; } nint FlattenedLength { get; } @@ -707,7 +707,7 @@ public void Clear() { } public void CopyTo(scoped System.Numerics.Tensors.TensorSpan destination) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("Equals() on TensorSpan will always throw an exception. Use the equality operator instead.")] - #pragma warning disable CS0809 // Obsolete member overrides non-obsolete member +#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member public override bool Equals(object? obj) { throw null; } #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member public void Fill(T value) { } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs index 57ec96024c27bd..bad5e28d41ecf9 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/ReadOnlyTensorSpan.cs @@ -105,7 +105,7 @@ public ReadOnlyTensorSpan(T[]? array, int start, scoped ReadOnlySpan lengt } else { - if (((uint)start > (uint)array.Length || (uint)maxElements > (uint)(array.Length - start)) && array.Length != 0) + if (((uint)start > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - start)) && array.Length != 0) ThrowHelper.ThrowArgument_InvalidStridesAndLengths(); } @@ -196,7 +196,7 @@ public ReadOnlyTensorSpan(Array? array, scoped ReadOnlySpan start, scoped R } else { - if (((uint)startOffset > (uint)array.Length || (uint)maxElements > (uint)(array.Length - startOffset)) && array.Length != 0) + if (((uint)startOffset > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - startOffset)) && array.Length != 0) ThrowHelper.ThrowArgumentOutOfRangeException(); } @@ -245,7 +245,7 @@ public ReadOnlyTensorSpan(Array? array, scoped ReadOnlySpan startIndex, } else { - if ((uint)startOffset > (uint)array.Length || (uint)maxElements > (uint)(array.Length - startOffset)) + if ((uint)startOffset > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - startOffset)) ThrowHelper.ThrowArgumentOutOfRangeException(); } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs index 50007fcaedb456..34311af8aa94af 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/Tensor.cs @@ -75,7 +75,7 @@ internal Tensor(T[]? values, ReadOnlySpan lengths, ReadOnlySpan stri } else { - if (((uint)maxElements > (uint)(values.Length)) && values.Length != 0) + if (((uint)maxElements >= (uint)(values.Length)) && values.Length != 0) ThrowHelper.ThrowArgument_InvalidStridesAndLengths(); } diff --git a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorSpan.cs b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorSpan.cs index c92c243bf3a889..b6e8826cb25569 100644 --- a/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorSpan.cs +++ b/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorSpan.cs @@ -107,7 +107,7 @@ public TensorSpan(T[]? array, int start, scoped ReadOnlySpan lengths, scop } else { - if (((uint)start > (uint)array.Length || (uint)maxElements > (uint)(array.Length - start)) && array.Length != 0) + if (((uint)start > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - start)) && array.Length != 0) ThrowHelper.ThrowArgument_InvalidStridesAndLengths(); } @@ -200,7 +200,7 @@ public TensorSpan(Array? array, scoped ReadOnlySpan start, scoped ReadOnlyS } else { - if (((uint)startOffset > (uint)array.Length || (uint)maxElements > (uint)(array.Length - startOffset)) && array.Length != 0) + if (((uint)startOffset > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - startOffset)) && array.Length != 0) ThrowHelper.ThrowArgumentOutOfRangeException(); } @@ -248,7 +248,7 @@ public TensorSpan(Array? array, scoped ReadOnlySpan startIndex, scoped R } else { - if ((uint)startOffset > (uint)array.Length || (uint)maxElements > (uint)(array.Length - startOffset)) + if ((uint)startOffset > (uint)array.Length || (uint)maxElements >= (uint)(array.Length - startOffset)) ThrowHelper.ThrowArgumentOutOfRangeException(); }