From e2816c14897508c3bb5145887d1dc677cc5b975e Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Tue, 25 Jan 2005 01:35:02 +0000 Subject: [PATCH] Take a swing at using roundup(). --- usr.bin/column/column.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index 1082f57930a5..4ac5b244b830 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -140,7 +141,7 @@ main(int argc, char **argv) if (!entries) exit(eval); - maxlength = (maxlength + TAB) & ~(TAB - 1); + maxlength = roundup(maxlength, TAB); if (tflag) maketbl(); else if (maxlength >= termwidth) @@ -170,7 +171,7 @@ c_columnate(void) endcol = maxlength; putwchar('\n'); } else { - while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { + while ((cnt = roundup(chcnt, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; } @@ -198,7 +199,7 @@ r_columnate(void) chcnt += width(list[base]); if ((base += numrows) >= entries) break; - while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) { + while ((cnt = roundup(chcnt, TAB)) <= endcol) { (void)putwchar('\t'); chcnt = cnt; }