Avoid implicit casts and make code more portable (#716)

This commit is contained in:
tdcosta100
2023-01-23 07:32:53 -03:00
committed by GitHub
parent e47efe3761
commit d5acff3c74
18 changed files with 63 additions and 61 deletions

View File

@@ -23,7 +23,7 @@ public:
map.getStyle().loadJSON(util::read_file("benchmark/fixtures/api/style.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
map.getStyle().addImage(std::make_unique<style::Image>("test-icon",
decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0));
decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0f));
frontend.render(map);
}

View File

@@ -39,7 +39,7 @@ void prepare(Map& map, optional<std::string> json = nullopt) {
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png"));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0f));
}
void prepare_map2(Map& map, optional<std::string> json = nullopt) {
@@ -47,7 +47,7 @@ void prepare_map2(Map& map, optional<std::string> json = nullopt) {
map.jumpTo(CameraOptions().withCenter(LatLng{41.379800, 2.176810}).withZoom(15.0)); // Barcelona
auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png"));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0f));
}
} // end namespace

View File

@@ -28,20 +28,20 @@ static void Util_dtoa(::benchmark::State& state) {
static void Util_standardDtoa(::benchmark::State& state) {
while (state.KeepRunning()) {
std::to_string(0.);
std::to_string(M_E);
std::to_string(M_LOG2E);
std::to_string(M_LOG10E);
std::to_string(M_LN2);
std::to_string(M_LN10);
std::to_string(M_PI);
std::to_string(M_PI_2);
std::to_string(M_PI_4);
std::to_string(M_1_PI);
std::to_string(M_2_PI);
std::to_string(M_2_SQRTPI);
std::to_string(M_SQRT2);
std::to_string(M_SQRT1_2);
std::ignore = std::to_string(0.);
std::ignore = std::to_string(M_E);
std::ignore = std::to_string(M_LOG2E);
std::ignore = std::to_string(M_LOG10E);
std::ignore = std::to_string(M_LN2);
std::ignore = std::to_string(M_LN10);
std::ignore = std::to_string(M_PI);
std::ignore = std::to_string(M_PI_2);
std::ignore = std::to_string(M_PI_4);
std::ignore = std::to_string(M_1_PI);
std::ignore = std::to_string(M_2_PI);
std::ignore = std::to_string(M_2_SQRTPI);
std::ignore = std::to_string(M_SQRT2);
std::ignore = std::to_string(M_SQRT1_2);
}
}
@@ -54,8 +54,8 @@ static void Util_dtoaLimits(::benchmark::State& state) {
static void Util_standardDtoaLimits(::benchmark::State& state) {
while (state.KeepRunning()) {
std::to_string(DBL_MIN);
std::to_string(DBL_MAX);
std::ignore = std::to_string(DBL_MIN);
std::ignore = std::to_string(DBL_MAX);
}
}