Right Shift not working

I working on in-line assembly in the smart contract.

function rightShift(uint256 x) public pure returns (uint256 result) {

       assembly {

          result := shr(x,1)



Above function always return zero. Am I doing something wrong or it’s bug?

The order is reversed. The above code is equivalent to 1 >> x which is 0 for non zero x.

1 Like