From d802d5f5435d657148b95137eebe0ea353172401 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Tue, 2 Apr 2024 21:46:19 +0300 Subject: [PATCH] Replace mround with STL lround --- src/similar.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/similar.cc b/src/similar.cc index bcd43661..74acf683 100644 --- a/src/similar.cc +++ b/src/similar.cc @@ -22,6 +22,7 @@ #include "similar.h" #include +#include #include #include @@ -218,13 +219,6 @@ void image_sim_alternate_processing(ImageSimilarityData *sd) } } -gint mround(gdouble x) -{ - gint ipart = x; - gdouble fpart = x-ipart; - return (fpart < 0.5 ? ipart : ipart+1); -} - void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf) { gint w; @@ -278,7 +272,7 @@ void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf) for (ys = 0; ys < 32; ys++) { if (y_small) j = static_cast(h) / 32 * ys; - else y_inc = mround(static_cast(h_left)/(32-ys)); + else y_inc = std::lround(static_cast(h_left)/(32-ys)); i = 0; w_left = w; @@ -293,7 +287,7 @@ void image_sim_fill_data(ImageSimilarityData *sd, GdkPixbuf *pixbuf) guchar *xpos; if (x_small) i = static_cast(w) / 32 * xs; - else x_inc = mround(static_cast(w_left)/(32-xs)); + else x_inc = std::lround(static_cast(w_left)/(32-xs)); xy_inc = x_inc * y_inc; r = g = b = 0; xpos = pix + (i * p_step); -- 2.20.1