On Wed, Feb 5, 2025 at 6:36 AM Anton Moryakov <[email protected]> wrote: > diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c > index 2934d8eb7..96644865e 100644 > --- a/miscutils/fbsplash.c > +++ b/miscutils/fbsplash.c > @@ -353,7 +353,7 @@ static void fb_drawprogressbar(unsigned percent) > while (i >= 0) { > // draw one-line thick "rectangle" > // top line will have gray lvl 200, bottom one 100 > - unsigned gray_level = 100 + (unsigned)i*100 / height; > + unsigned gray_level = 100 + (unsigned)i / height * > 100; > fb_drawfullrectangle( > left_x, y, pos_x, y, > gray_level, gray_level, gray_level);
Division before multiplication can lose precision due to rounding. Unless "i" is guaranteed to be a multiple of "height". _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
