[PATCH] font: fbconsole: use DIV_ROUND_UP for clarity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux