Consider the following application:
using System;
class Program
{
static void Main()
{
ReadOnlySpan<byte> data = [50];
byte lowInclusive = 200;
byte highInclusive = 100;
int idx = data.IndexOfAnyInRange(lowInclusive, highInclusive);
Console.WriteLine(idx);
}
}
On an Apple M1 processor (and maybe other architectures), this will behave differently depending on if hardware intrinsics are available, or not.
Regularly:
With intrinsics disabled:
❯ DOTNET_EnableHWIntrinsic=0 dotnet run
-1
Since this is not a "low level" SIMD API, I think it would be ideal if the invalid ranges produced consistent results (or threw an exception, but that is perhaps a breaking change).