summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-26 15:03:15 +0000
committerpfg <pfg@FreeBSD.org>2016-04-26 15:03:15 +0000
commit96555d383362c30d444593333d60a4588416db62 (patch)
treedf1bb710ebf946f1a7c1b38464ef836fddfee71c /sys/dev/vt
parent8f98488963488a3a64220dd06361d0286c15cdb4 (diff)
downloadFreeBSD-src-96555d383362c30d444593333d60a4588416db62.zip
FreeBSD-src-96555d383362c30d444593333d60a4588416db62.tar.gz
sys/dev: extend use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/hw/vga/vt_vga.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c
index 62c9bf3..e81dcba 100644
--- a/sys/dev/vt/hw/vga/vt_vga.c
+++ b/sys/dev/vt/hw/vga/vt_vga.c
@@ -815,9 +815,8 @@ vga_bitblt_text_gfxmode(struct vt_device *vd, const struct vt_window *vw,
col = area->tr_end.tp_col;
row = area->tr_end.tp_row;
- x2 = (int)((col * vf->vf_width + vw->vw_draw_area.tr_begin.tp_col
- + VT_VGA_PIXELS_BLOCK - 1)
- / VT_VGA_PIXELS_BLOCK)
+ x2 = (int)howmany(col * vf->vf_width + vw->vw_draw_area.tr_begin.tp_col,
+ VT_VGA_PIXELS_BLOCK)
* VT_VGA_PIXELS_BLOCK;
y2 = row * vf->vf_height + vw->vw_draw_area.tr_begin.tp_row;
@@ -916,8 +915,7 @@ vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw,
x1 = x / VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK;
y1 = y;
- x2 = (x + width + VT_VGA_PIXELS_BLOCK - 1) /
- VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK;
+ x2 = roundup(x + width, VT_VGA_PIXELS_BLOCK);
y2 = y + height;
x2 = min(x2, vd->vd_width - 1);
y2 = min(y2, vd->vd_height - 1);
OpenPOWER on IntegriCloud