[beam] Use direct iota instead of binary shift

This prevents issues on 32bit systems.
ping @shykes, @vieux 

Alternative to #5733 per @crosbymichael's comment.