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 a75e8c4 commit b9d2d3c
Showing 1 changed file with 1 addition and 1 deletion.
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 b9d2d3c

Please sign in to comment.