Skip to content

Commit 1fac512

Browse files
committed
Relaxed constraints
1 parent f68195a commit 1fac512

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DotNext/Numerics/Number.BitVector.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static partial class Number
1717
/// <returns><see langword="true"/> if the bit at <paramref name="position"/> is set; otherwise, <see langword="false"/>.</returns>
1818
/// <exception cref="ArgumentOutOfRangeException"><paramref name="position"/> is negative.</exception>
1919
public static bool IsBitSet<T>(this T number, int position)
20-
where T : struct, IBinaryNumber<T>, IShiftOperators<T, int, T>
20+
where T : struct, INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
2121
{
2222
ArgumentOutOfRangeException.ThrowIfNegative(position);
2323

@@ -34,7 +34,7 @@ public static bool IsBitSet<T>(this T number, int position)
3434
/// <returns>A modified number.</returns>
3535
/// <exception cref="ArgumentOutOfRangeException"><paramref name="position"/> is negative.</exception>
3636
public static T SetBit<T>(this T number, int position, bool value)
37-
where T : struct, IBinaryNumber<T>, IShiftOperators<T, int, T>
37+
where T : struct, INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
3838
{
3939
ArgumentOutOfRangeException.ThrowIfNegative(position);
4040

@@ -51,7 +51,7 @@ public static T SetBit<T>(this T number, int position, bool value)
5151
/// <param name="bits">A vector of bits.</param>
5252
/// <returns>A value of type <typeparamref name="TResult"/> restored from the vector of bits.</returns>
5353
public static TResult FromBits<TResult>(this ReadOnlySpan<bool> bits)
54-
where TResult : struct, IBinaryNumber<TResult>, IShiftOperators<TResult, int, TResult>
54+
where TResult : struct, INumber<TResult>, IBitwiseOperators<TResult, TResult, TResult>, IShiftOperators<TResult, int, TResult>
5555
{
5656
var result = TResult.Zero;
5757

@@ -72,7 +72,7 @@ public static TResult FromBits<TResult>(this ReadOnlySpan<bool> bits)
7272
/// <param name="bits">A buffer to be modified.</param>
7373
/// <exception cref="ArgumentOutOfRangeException"><paramref name="bits"/> has not enough length.</exception>
7474
public static unsafe void GetBits<T>(this T value, Span<bool> bits)
75-
where T : unmanaged, IBinaryNumber<T>, IShiftOperators<T, int, T>
75+
where T : unmanaged, INumber<T>, IBitwiseOperators<T, T, T>, IShiftOperators<T, int, T>
7676
{
7777
var sizeInBits = sizeof(T) * 8;
7878
ArgumentOutOfRangeException.ThrowIfLessThan((uint)bits.Length, (uint)sizeInBits, nameof(bits));

0 commit comments

Comments
 (0)