Skip to content

Commit

Permalink
Fixed bounds check
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jan 13, 2024
1 parent 295e4f8 commit d613c09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DotNext/Numerics/Number.BitVector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static unsafe void GetBits<T>(this T value, Span<bool> bits)
var sizeInBits = sizeof(T) * 8;
ArgumentOutOfRangeException.ThrowIfLessThan((uint)bits.Length, (uint)sizeInBits, nameof(bits));

if (Vector256.IsHardwareAccelerated && int.IsEvenInteger(sizeInBits))
if (Vector256.IsHardwareAccelerated && int.IsEvenInteger(sizeof(T)))
{
Get16Bits(ref Unsafe.As<T, byte>(ref value), sizeof(T), ref MemoryMarshal.GetReference(bits));
}
Expand Down

0 comments on commit d613c09

Please sign in to comment.