summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2021-05-10 23:37:37 -0400
committerNicolas Pitre <nico@fluxnic.net>2021-05-10 23:37:37 -0400
commit627799c1e4253108520167c1d7cc682813dc7ced (patch)
tree38f3af871b457759340c898712c49b8add0213c9
parent49f8010b606b92c21ec46d706b992d382b1acb84 (diff)
avoid floating point computation when integer computation is sufficient
Floats are much more expensive to use in CPU cycles than integers.
-rw-r--r--src/tui.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tui.c b/src/tui.c
index 080c3e6..7b916ca 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -1010,7 +1010,7 @@ void ui_show_content(WINDOW * win, int row_boundary, int col_boundary) {
// auto wrap
if (!conf_truncate && !conf_overlap && conf_autowrap) {
- int newheight = ceil(wcslen(out) * 1.0 / fwidth[col]);
+ int newheight = (wcslen(out) + fwidth[col] - 1) / fwidth[col];
if (row_format[row] < newheight) row_format[row] = newheight;
}