* [PATCH] font: fbconsole: use DIV_ROUND_UP for clarity
@ 2024-09-11 8:17 Ahmad Fatoum
2024-09-11 8:30 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-09-11 8:17 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Adding X - 1 and then dividing by X is effectively rounding up, so let's
use the macro to make this clearer.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
lib/fonts/fonts.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/fonts/fonts.c b/lib/fonts/fonts.c
index e08b75fbccc0..b3bdaa21a2aa 100644
--- a/lib/fonts/fonts.c
+++ b/lib/fonts/fonts.c
@@ -35,8 +35,7 @@ int find_font_index(const struct font_desc *font, int ch)
{
int index;
if (font->index == NULL) {
- index = font->width + 7;
- index /= 8;
+ index = DIV_ROUND_UP(font->width, 8);
index *= font->height;
index *= ch;
} else {
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-11 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-11 8:17 [PATCH] font: fbconsole: use DIV_ROUND_UP for clarity Ahmad Fatoum
2024-09-11 8:30 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox