Skip to content

Commit

Permalink
cast to int explicitly to avoid "Implicit conversion from float to in…
Browse files Browse the repository at this point in the history
…t loses precision"
  • Loading branch information
sidz committed Oct 11, 2021
1 parent 01b0eb7 commit 0426d7f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function bucketSort(array $uniqueTestLocations): iterable
// This is a very hot path. Factoring here another method just to test this math may not be as good idea.

// Quick drop off lower bits, reducing precision to 8th of a second
$msTime = $location->getExecutionTime() * 1024 >> 7; // * 1024 / 128
$msTime = (int) ($location->getExecutionTime() * 1024) >> 7; // * 1024 / 128

// For anything above 4 seconds reduce precision to 4 seconds
if ($msTime > 32) {
Expand Down

0 comments on commit 0426d7f

Please sign in to comment.