Fix performance-type-promotion-in-math-fn clang-tidy warning (#6908)

This commit is contained in:
Siarhei Fedartsou
2024-05-27 08:33:05 +02:00
committed by GitHub
parent 163a2cfe3c
commit 1a6f4c44e7
5 changed files with 26 additions and 28 deletions
+4 -4
View File
@@ -497,13 +497,13 @@ void encodeVectorTile(const DataFacadeBase &facade,
{
// Calculate the speed for this line
std::uint32_t speed_kmh_idx = static_cast<std::uint32_t>(
round(length / from_alias<double>(forward_duration) * 10 * 3.6));
std::round(length / from_alias<double>(forward_duration) * 10 * 3.6));
// Rate values are in meters per weight-unit - and similar to speeds, we
// present 1 decimal place of precision (these values are added as
// double/10) lower down
std::uint32_t forward_rate = static_cast<std::uint32_t>(
round(length / from_alias<double>(forward_weight) * 10.));
std::round(length / from_alias<double>(forward_weight) * 10.));
auto tile_line = coordinatesToTileLine(a, b, tile_bbox);
if (!tile_line.empty())
@@ -531,13 +531,13 @@ void encodeVectorTile(const DataFacadeBase &facade,
{
// Calculate the speed for this line
std::uint32_t speed_kmh_idx = static_cast<std::uint32_t>(
round(length / from_alias<double>(reverse_duration) * 10 * 3.6));
std::round(length / from_alias<double>(reverse_duration) * 10 * 3.6));
// Rate values are in meters per weight-unit - and similar to speeds, we
// present 1 decimal place of precision (these values are added as
// double/10) lower down
std::uint32_t reverse_rate = static_cast<std::uint32_t>(
round(length / from_alias<double>(reverse_weight) * 10.));
std::round(length / from_alias<double>(reverse_weight) * 10.));
auto tile_line = coordinatesToTileLine(b, a, tile_bbox);
if (!tile_line.empty())
+2 -2
View File
@@ -40,8 +40,8 @@ RasterDatum RasterSource::GetRasterData(const int lon, const int lat) const
return {};
}
const std::size_t xth = static_cast<std::size_t>(round((lon - xmin) / xstep));
const std::size_t yth = static_cast<std::size_t>(round((ymax - lat) / ystep));
const std::size_t xth = static_cast<std::size_t>(std::round((lon - xmin) / xstep));
const std::size_t yth = static_cast<std::size_t>(std::round((ymax - lat) / ystep));
return {raster_data(xth, yth)};
}