simd comparison operator?
Don
don at nospam.com
Tue Feb 19 06:45:04 PST 2013
On Tuesday, 19 February 2013 at 14:03:54 UTC, monarch_dodra wrote:
> Are there any plans that would allow using opEqual or opCmp
> operators with simd?
>
> My use case is that I have arrays, and I need to verify that
> ALL the elements in my array are comprised between two values
> (in this specific case 10 and 93).
>
> I was hoping I would be able to use:
> ubyte[] arr = ...
> if (arr []< 10 || arr[]> 93) throw Exception();
>
> But that doesn't seem to work.
>
> Neither does simple opEqual comparison.
> //Make sure arr is initialized to 0
> if (arr[] != 0)
>
> Is this a "never thought of this and not implemented" issue, or
> is there a reason that simd can't do this? I find it strange,
> since simd allows for straight up array to array opEquals, but
> not array to value?
Simd comparison generally doesn't return a bool, it returns a
bool array,
one per element.
Does (arr[] < 10) mean "is every element in arr less than 10" OR
"is any element of arr less than 10" OR "create a bool array
which is true for each element which is less than 10" ?
All make sense. That's the problem.
More information about the Digitalmars-d
mailing list