From a75a9444dbcf2bd93bc7c13124e919264f1a4d45 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Thu, 16 May 2019 11:54:43 -0400 Subject: [PATCH] Use DIVROUND here too, for consistency. --- wincon/pdcdisp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wincon/pdcdisp.c b/wincon/pdcdisp.c index 0e005a45..fe898ef8 100644 --- a/wincon/pdcdisp.c +++ b/wincon/pdcdisp.c @@ -60,9 +60,9 @@ void _set_ansi_color(short f, short b, attr_t attr) p += sprintf(p, "38;5;%d", f); else { - short red = pdc_color[f].r * 255 / 1000; - short green = pdc_color[f].g * 255 / 1000; - short blue = pdc_color[f].b * 255 / 1000; + short red = DIVROUND(pdc_color[f].r * 255, 1000); + short green = DIVROUND(pdc_color[f].g * 255, 1000); + short blue = DIVROUND(pdc_color[f].b * 255, 1000); p += sprintf(p, "38;2;%d;%d;%d", red, green, blue); } @@ -83,9 +83,9 @@ void _set_ansi_color(short f, short b, attr_t attr) p += sprintf(p, "48;5;%d", b); else { - short red = pdc_color[b].r * 255 / 1000; - short green = pdc_color[b].g * 255 / 1000; - short blue = pdc_color[b].b * 255 / 1000; + short red = DIVROUND(pdc_color[b].r * 255, 1000); + short green = DIVROUND(pdc_color[b].g * 255,1000); + short blue = DIVROUND(pdc_color[b].b * 255, 1000); p += sprintf(p, "48;2;%d;%d;%d", red, green, blue); }