Bitwise shift operation from NAND?
A shift operation like what a >> or &lt;&lt; compiles to is done with a (barrel) shifter.

You can build one by using a decoder and a cross bar of links with AND gates connecting the verticals and the horizontals. Then the output of the decoder will travel diagonally.

Another option is to use muliplexers and have several layers:







simulate this circuit &ndash; Schematic created using CircuitLab

This is a 4 bit logical right-shift circuit. ShiftAmount0 is the least significant bit and shiftAmount1 is the next least significant bit.

You can grow this circuit by making the 1 input of the mux double the jump it makes. You can also connect the 1 inputs of the higher significant bits to the lower significant bits (for barrel shift) or the highest bit (for arithmetic shift). This you can do with a few AND gates to select the correct behavior.