store shiftmask bits in temporary otherwise the expression gets duplicated