in reply to Implementing a signed/sign-propagating right bitwise shift
"(1 << $firstbit)" seems to be a constant. Extract it from the loop and it should be faster.
You could remove the loop completely by (in the case of 32 bit) checking the high-bit, then shifting for $y, then or-ing with $FFFFFFFF shifted left 32-$y
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Implementing a signed/sign-propagating right bitwise shift
by LonelyPilgrim (Beadle) on Feb 16, 2012 at 17:39 UTC | |
by ikegami (Patriarch) on Feb 16, 2012 at 17:57 UTC | |
by jethro (Monsignor) on Feb 16, 2012 at 18:01 UTC | |
by LonelyPilgrim (Beadle) on Feb 16, 2012 at 18:29 UTC |