Simplify multiplications by vectors whose elements are powers of 2.

Patch by Andrea Di Biagio.