Reducing `d` helps by a few percent, good eye.  I can't detect an improvement for replacing `*2` with `<<1` here, and I think it makes the code less clear, so I'll let that be.