PHP 32-bit Left Shift Function
PHP:
-
function leftshift32($number, $steps)
-
{
-
// convert to binary (string)
-
// left-pad with 0's if necessary
-
// left shift manually
-
// get the last 32 bits
-
// if it's a negative number return the 2's complement
-
// otherwise just return the number
-
if ($binary{0} == "1")
-
{
-
}
-
else
-
{
-
}
-
}
Comments: