signedRightShift method
Returns this
right-shifted by n
bytes assuming bitWidth
.
This is intended to be roughly equivalent to JavaScript's >>
operator.
NOTE:
bitWidth
is not validated. See Integral.signedRightShift.
Implementation
int signedRightShift(int n, int bitWidth) {
final padding = msb(bitWidth) ? 2.pow(n) - 1 : 0;
return (padding << (bitWidth - n)) | (this >> n);
}