Excellent. Thanks. Here's a rewrite. The overall alg still seems to work.

EDIT: The above is overly-complicated. All you need do is this:Code:`// Logical Right-Shift`

int lrs(int x, int n) {

if (x < 0) {

x = (x >> 1) & INT_MAX;

n--;

}

return (n > 0) ? x >> n : x;

}

Code:`int lrs(int x, int n) {`

return (int)((unsigned)x >> n);

}