Open LEI-Hongfaan opened 2 months ago
Tagging subscribers to this area: @dotnet/area-system-numerics See info in area-owners.md if you want to be subscribed.
public static abstract TResult BitwiseAndNot(TSelf left, TOther right);
Adding abstract
method is a breaking change and unacceptable. Instead, this should be a static virtual
method with fallback implementation.
Background and motivation
Certain architectures have specialized instructions to compute the AND NOT operation efficiently. By using these instructions, we can perform bitwise operations faster.
API Proposal
API Usage
For example, when performing a bitwise AND operation on BigInteger values, if
x
is nonnegative andy
is negative, thenx & y = x & ~(abs(y) - 1)
. In code, this would look like:Alternative Designs
AndNot
instead ofBitwiseAndNot
BitwiseAndNot
in another interface.Risks
No response