[vector] Is Mask inverted in XXXVector.xxxAll(Mask<>)?

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Mar 22 17:21:32 UTC 2019


>> It looks naturally when you compare it to other masked operations:
>>
>>    a.op(m)       == (m_i ? op(a_i)     : a_i)
>>
>>    a.op(b, m)    == (m_i ? op(a_i,b_i) : a_i)
>>
>>    a.blend(b, m) == (m_i ? b_i         : a_i) // ok
>>
>> but it's confusing (at least, to me) when you see it alone:
>>
>>    a.blend(b, m);
>>
>> I read it as 'blend(a,b,m)' and the first interpretation usually is
>> opposite to the actual behavior.
>   For me it was natural ("take from B what is marked in M, default take
> from A"), bu Javadoc was misleading :-)

Thanks for the input, Lev. Can you elaborate, please, what misled you in 
the Javadoc?

     /**
      * Blends the lane elements of this vector with those of an input 
vector,
      * selecting lanes controlled by a mask.
      * <p>
      * For each lane of the mask, at lane index {@code N}, if the mask lane
      * is set then the lane element at {@code N} from the input vector is
      * selected and placed into the resulting vector at {@code N},
      * otherwise the the lane element at {@code N} from this input 
vector is
      * selected and placed into the resulting vector at {@code N}.

Best regards,
Vladimir Ivanov


More information about the panama-dev mailing list