Bit-wise operations to implement logical shift to the right [duplicate]
问题 This question already has answers here : Implementing Logical Right Shift in C (8 answers) Closed 11 months ago . So I am trying to solve this home assignment and I have been stuck with this one particular problem for a couple of hours and can't figure it out. I feel like I am so close! But then i change something in the code and something else isn't right.. /* * logicalShift - shift x to the right by n, using a logical shift * Can assume that 0 <= n <= 31 * Examples: logicalShift(0x87654321