Arithmetic operators applied to vectors treat the vectors as unsigned binary numbers. As stated above, if the vectors are of unequal length, the shorter vector is prepended with a vector of zeros to make the lengths equal. Thus
[0,1,1,0] + [1,0]is equivalent to
[0,1,1,0] + [0,0,1,0]
The arithmetic operator is then applied to the unsigned binary numbers
represented by the two vectors, yielding an unsigned binary
representation of the result, of the same length as the argument
vectors. The operators are the same as they are on integers, except
the result is modulo , where
is the vector length. The
result is always negative (in the range
). For
example,
[0,1,1,0] + [0,0,1,0] = [1,0,0,0]and
[1,1,1,0] + [0,0,1,0] = [0,0,0,0]
Note that, since the arithmetic is modular, it doesn't actually matter whether we look at it as signed or unsigned, except that extension is always by zeros. This extension by zeros implicitly treats vectors as unsigned numbers.