![]() |
Bitwise Operator Question
I looked in the documentation and searched around the forum, but there doesn't seem to be a function for circularly rotating (shifting) bits in a bitwise fashion. Wondering if anyone knows one of the top of their head or if there's something I overlooked in the manual? Thx for the help.
|
Never mind it was on the php.net site but not in the manual. Someone was nice enough to post the function that they use
[PHP]function bitRotate32($value,$amount) { if ($amount>0) { $amount %= 32; $value = ($value<<$amount) | ($value>>(32-$amount)); } elseif ($amount<0) { $amount = -$amount%32; $value = ($value>>$amount) | ($value<<(32-$amount)); } return $value; }[/PHP] |
| All times are GMT -5. The time now is 1:27 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC