Reputation: 229461
According to here, arithmetic-shift
will bit-shift left and right. The right shift preserves the sign. Is there any unsigned right-shift operator, which fills the vacated bits with zero instead of the sign bit?
Upvotes: 1
Views: 531
Reputation: 49099
Shift it right by 1 bit, then zero out the sign bit. Then shift it by however many extra bits you need.
Upvotes: 1