Claudiu
Claudiu

Reputation: 229461

How to do bit-wise zero-filling right shift in Scheme?

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

Answers (1)

Artelius
Artelius

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

Related Questions