From 59f3449670535ced8d4f7c98b715b1765fb0e670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Agostinho?= Date: Sun, 20 Oct 2019 15:15:39 +0200 Subject: [PATCH] Suppress -Wtype-limits warning. --- simulation/tools/simulation_io.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simulation/tools/simulation_io.cpp b/simulation/tools/simulation_io.cpp index f0b8e747892..108fb52042d 100644 --- a/simulation/tools/simulation_io.cpp +++ b/simulation/tools/simulation_io.cpp @@ -248,10 +248,10 @@ pcl::simulation::SimExample::write_depth_image_uint(const float* depth_buffer, float zf = 20.0; float d = depth_buffer[i_in]; - unsigned short z_new = (unsigned short)std::floor( - 1000 * (-zf * zn / ((zf - zn) * (d - zf / (zf - zn))))); - if (z_new > 65535) - z_new = 65535; + unsigned short z_new = static_cast (std::min ( + std::floor(1000 * (-zf * zn / ((zf - zn) * (d - zf / (zf - zn))))), + 65535.f + )); if (z_new < 18000) { std::cout << z_new << " " << d << " " << x << "\n";