summaryrefslogtreecommitdiff
path: root/sys/src/cmd/jpg/writetif.c
diff options
context:
space:
mode:
authorppatience0 <ppatience0@gmail.com>2013-07-20 18:00:34 -0400
committerppatience0 <ppatience0@gmail.com>2013-07-20 18:00:34 -0400
commit171db68c3dfb64b7d4671f7ba68ff9e0b5e726df (patch)
tree8a3c5ba4a4820cbe9ddf21fb02ca5c6d653ea747 /sys/src/cmd/jpg/writetif.c
parent0fc3aa99a1679e3d853c5be9358a6a33a76d7694 (diff)
readtif, writetif: simplify rounding
Diffstat (limited to 'sys/src/cmd/jpg/writetif.c')
-rw-r--r--sys/src/cmd/jpg/writetif.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/src/cmd/jpg/writetif.c b/sys/src/cmd/jpg/writetif.c
index 983684e1a..10de12ed7 100644
--- a/sys/src/cmd/jpg/writetif.c
+++ b/sys/src/cmd/jpg/writetif.c
@@ -1041,19 +1041,14 @@ alloctif(Tif *t)
{
int rgb;
ulong i, count, n;
- double a, b;
count = t->ndata < 0x2000? t->ndata: 0x2000;
- t->rows = count / t->bpl;
- if(count%t->bpl != 0)
- t->rows++;
+ t->rows = (count + t->bpl - 1) / t->bpl;
if(t->comp == Tt4enc && t->opt) {
if((n = t->rows%Kpar) != 0)
t->rows += Kpar - n;
}
- a = (double)t->dy;
- b = (double)t->rows;
- t->nstrips = (ulong)floor((a+b-1)/b);
+ t->nstrips = (t->dy + t->rows - 1) / t->rows;
t->strips = malloc(t->nstrips*sizeof *t->strips);
if(t->strips == nil)
return memerr;