in reply to Implementing a signed/sign-propagating right bitwise shift

The signed shift can be implemented in terms of a division:

sub sr_i32 { my ($p, $q) = @_; return int( $p / (2<<$q) ); }

Note that divisions by power of two are lossless.

Update: Previous implementation only worked with q=1, so provided a different implementation.