Binary expressions

Some binary expressions that are used with primitive data types are extended for the vector data types.

For binary operators, each element has the operation applied to it with the same position element in the second operand. Binary operators also include assignment operators.
Table 1. Binary operators
Operator Integer vector types Vector double Bool vector types
* Yes Yes No
/ Yes Yes No
% Yes No No
+ Yes Yes No
Yes Yes No
<< Yes No No
>> Yes No No
& Yes Yes Yes
^ Yes Yes Yes
| Yes Yes Yes
[] Yes Yes Yes
Notes:
  • The [] operator returns the vector element at the position specified.
  • These operators might not be portable.
For relational operators, each element has the operation applied to it with the same position element in the second operand and the results have the AND operator applied to them to get a final result of a single value. The following table provides a summary on the binary operators that can operate on some of the vector data types.
Table 2. Relational operators
Operator Integer vector types Vector double Bool vector types
== Yes Yes Yes
!= Yes Yes Yes
< Yes Yes No
> Yes Yes No
<= Yes Yes No
>= Yes Yes No

These operators are not supported at global scope or for objects with static duration, and there is no constant folding.

The following sections provide details on each of the supported binary operators with the vector data types. For general detailed information about binary operators, see Binary expressions in z/OS XL C/C++ Language Reference.