Implement logicalShift

This was easy because I just had to adapt 876937d92ee for the
requirements of this project