diff --git a/.clang-tidy b/.clang-tidy index c724cc0c4..89a5afdc4 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -54,7 +54,6 @@ Checks: > performance-*, -performance-noexcept-move-constructor, -performance-no-int-to-ptr, - -performance-type-promotion-in-math-fn, readability-*, -readability-avoid-const-params-in-decls, -readability-braces-around-statements, diff --git a/include/engine/api/route_api.hpp b/include/engine/api/route_api.hpp index cbff9ce3b..3b7c4f17c 100644 --- a/include/engine/api/route_api.hpp +++ b/include/engine/api/route_api.hpp @@ -443,23 +443,22 @@ class RouteAPI : public BaseAPI if (requested_annotations & RouteParameters::AnnotationsType::Speed) { double prev_speed = 0; - speed = - GetAnnotations(fb_result, - leg_geometry, - [&prev_speed](const guidance::LegGeometry::Annotation &anno) - { - if (anno.duration < std::numeric_limits::min()) - { - return prev_speed; - } - else - { - auto speed = - round(anno.distance / anno.duration * 10.) / 10.; - prev_speed = speed; - return util::json::clamp_float(speed); - } - }); + speed = GetAnnotations( + fb_result, + leg_geometry, + [&prev_speed](const guidance::LegGeometry::Annotation &anno) + { + if (anno.duration < std::numeric_limits::min()) + { + return prev_speed; + } + else + { + auto speed = std::round(anno.distance / anno.duration * 10.) / 10.; + prev_speed = speed; + return util::json::clamp_float(speed); + } + }); } flatbuffers::Offset> duration; diff --git a/src/engine/plugins/tile.cpp b/src/engine/plugins/tile.cpp index 17f896b6d..6bf9254eb 100644 --- a/src/engine/plugins/tile.cpp +++ b/src/engine/plugins/tile.cpp @@ -497,13 +497,13 @@ void encodeVectorTile(const DataFacadeBase &facade, { // Calculate the speed for this line std::uint32_t speed_kmh_idx = static_cast( - round(length / from_alias(forward_duration) * 10 * 3.6)); + std::round(length / from_alias(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( - round(length / from_alias(forward_weight) * 10.)); + std::round(length / from_alias(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( - round(length / from_alias(reverse_duration) * 10 * 3.6)); + std::round(length / from_alias(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( - round(length / from_alias(reverse_weight) * 10.)); + std::round(length / from_alias(reverse_weight) * 10.)); auto tile_line = coordinatesToTileLine(b, a, tile_bbox); if (!tile_line.empty()) diff --git a/src/extractor/raster_source.cpp b/src/extractor/raster_source.cpp index 72e9f8f5b..cda4f78f5 100644 --- a/src/extractor/raster_source.cpp +++ b/src/extractor/raster_source.cpp @@ -40,8 +40,8 @@ RasterDatum RasterSource::GetRasterData(const int lon, const int lat) const return {}; } - const std::size_t xth = static_cast(round((lon - xmin) / xstep)); - const std::size_t yth = static_cast(round((ymax - lat) / ystep)); + const std::size_t xth = static_cast(std::round((lon - xmin) / xstep)); + const std::size_t yth = static_cast(std::round((ymax - lat) / ystep)); return {raster_data(xth, yth)}; } diff --git a/unit_tests/library/route.cpp b/unit_tests/library/route.cpp index cc823816d..1e2f427a7 100644 --- a/unit_tests/library/route.cpp +++ b/unit_tests/library/route.cpp @@ -54,8 +54,8 @@ void test_route_same_coordinates_fixture(bool use_json_only_api) itr.get().values["hint"] = ""; // Round value to 6 decimal places for double comparison later - itr.get().values["distance"] = - round(itr.get().values["distance"].get().value * 1000000); + itr.get().values["distance"] = std::round( + itr.get().values["distance"].get().value * 1000000); } const auto location = json::Array{{{7.437070}, {43.749248}}}; @@ -65,11 +65,11 @@ void test_route_same_coordinates_fixture(bool use_json_only_api) {"waypoints", json::Array{{json::Object{{{"name", "Boulevard du Larvotto"}, {"location", location}, - {"distance", round(0.137249 * 1000000)}, + {"distance", std::round(0.137249 * 1000000)}, {"hint", ""}}}, json::Object{{{"name", "Boulevard du Larvotto"}, {"location", location}, - {"distance", round(0.137249 * 1000000)}, + {"distance", std::round(0.137249 * 1000000)}, {"hint", ""}}}}}}, {"routes", json::Array{{json::Object{