vec_cmprg_or_0_idx: Vector Compare Ranges or Zero Index
d = vec_cmprg_or_0_idx(a, b, c)
Returns
the lowest byte-index of the element of a that is
0 or within any of the ranges specified by b and c.
Each even-odd element pairs of b define values for
the limits of the ranges. The corresponding even-odd pairs of elements
in c control how the comparison to be performed,
in the following way:
Comparison | for vector unsigned char | for vector unsigned short | for vector unsigned int |
---|---|---|---|
ignore - result of comparison always TRUE | 0 | 0 | 0 |
equal | 0x80 | 0x8000 | 0x80000000 |
not equal | 0x60 | 0x6000 | 0x60000000 |
greater than | 0x20 | 0x2000 | 0x20000000 |
greater than or equal | 0xA0 | 0xA000 | 0xA0000000 |
less than | 0x40 | 0x4000 | 0x40000000 |
less than and equal | 0xC0 | 0xC000 | 0xC0000000 |
force to FALSE | 0xE0 | 0xE000 | 0xE0000000 |
The result is the lowest byte-index from element of a that is 0 or contained in any of the specified ranges. Otherwise, the result is 16.
The result is placed into byte element seven of the returned vector, and all other bytes are set to 0.
d | a | b | c |
---|---|---|---|
vector unsigned char | vector unsigned char | vector unsigned char | vector unsigned char |
vector unsigned short | vector unsigned short | vector unsigned short | vector unsigned short |
vector unsigned int | vector unsigned int | vector unsigned int | vector unsigned int |
Example:
vector unsigned int a = {1, 0, 22, 33};
vector unsigned int b = {10, 20, 30, 40};
vector unsigned int c = {0x20000000, 0x40000000, 0x20000000,
0x40000000}; // {GT, LT, GT, LT}
vector unsigned int d = vec_cmprg_or_0_idx(a, b, c); // byte 7 of d = 4
In
this example, each element of a is tested to be (equals
to 0) OR (> 10 AND < 5) OR (>30 AND < 40), the second element
(byte index 4) is the first element satisfying the condition.