Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update binary tools
  • Loading branch information
m3m0r7 committed Mar 4, 2019
commit 4c5c68fa52fc2cc06117f1119cfae94ddd231307
6 changes: 3 additions & 3 deletions src/Utilities/BinaryTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ final public static function andBits($value1, $value2, $bytes)
return base_convert($build, 2, 10);
}

final public static function convertDoubleToIEEE754($doubleValue, $rounded = 8)
final public static function convertDoubleToIEEE754($doubleValue)
{
$bits = $doubleValue;
$s = ($bits >> 63) == 0 ? 1 : -1;
Expand All @@ -205,12 +205,12 @@ final public static function convertDoubleToIEEE754($doubleValue, $rounded = 8)
return $s * $m * pow(2, $e - 1075);
}

final public static function convertFloatToIEEE754($floatValue, $rounded = 8)
final public static function convertFloatToIEEE754($floatValue)
{
$bits = $floatValue;
$s = ($bits >> 31) == 0 ? 1 : -1;
$e = ($bits >> 23) & 0xff;
$m = ($e == 0) ? ($bits & 0x7fffff) << 1 : ($bits & 0x7fffff) | 0x800000;;
$m = ($e == 0) ? (($bits & 0x7fffff) << 1) : ($bits & 0x7fffff) | 0x800000;
return $s * $m * pow(2, $e - 150);
}
}