From b4df5e1df77ee72faeb6b8e95807a4c8d3965667 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Sat, 2 Feb 2008 15:39:27 +0100 Subject: [PATCH] Use round_up() a bit more. --- tpl2ppm.c | 10 +++++----- zeventig.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tpl2ppm.c b/tpl2ppm.c index 6db1935..bb6c843 100644 --- a/tpl2ppm.c +++ b/tpl2ppm.c @@ -34,7 +34,7 @@ static void i4(int w, int h, int o, char *name) u8 pix[3]; u16 raw; int x0, x1, y0, y1, off; - int ww = (w + 7) & ~7; + int ww = round_up(w, 8); x0 = x & 7; x1 = x >> 3; @@ -72,7 +72,7 @@ static void i8(int w, int h, int o, char *name) u8 pix[3]; u16 raw; int x0, x1, y0, y1, off; - int ww = (w + 7) & ~7; + int ww = round_up(w, 8); x0 = x & 7; x1 = x >> 3; @@ -106,7 +106,7 @@ static void ia4(int w, int h, int o, char *name) u8 pix[3]; u16 raw; int x0, x1, y0, y1, off; - int ww = (w + 7) & ~7; + int ww = round_up(w, 8); x0 = x & 7; x1 = x >> 3; @@ -143,7 +143,7 @@ static void rgb5a3(int w, int h, int o, char *name) u8 pix[3]; u16 raw; int x0, x1, y0, y1, off; - int ww = (w + 3) & ~3; + int ww = round_up(w, 4); x0 = x & 3; x1 = x >> 2; @@ -209,7 +209,7 @@ static void cmp(int w, int h, int o, char *name) u16 raw; u16 c[4]; int x0, x1, x2, y0, y1, y2, off; - int ww = (w + 7) & ~7; + int ww = round_up(w, 8); int ix; u32 px; diff --git a/zeventig.c b/zeventig.c index fb8bcb0..c776e52 100644 --- a/zeventig.c +++ b/zeventig.c @@ -20,7 +20,7 @@ static u8 *get_wad(u32 len) u32 rounded_len; u8 *p; - rounded_len = (len + 0x3f) & ~0x3f; + rounded_len = round_up(len, 0x40); p = malloc(rounded_len); if (p == 0) fatal("malloc"); @@ -82,7 +82,7 @@ static void do_app_file(u8 *app, u32 app_len, u8 *tik, u8 *tmd) index = be16(tmd + 0x01e8 + 0x24*i); type = be16(tmd + 0x01ea + 0x24*i); len = be64(tmd + 0x01ec + 0x24*i); - rounded_len = (len + 0x3f) & ~0x3f; + rounded_len = round_up(len, 0x40); fprintf(stderr, "--- cid=%08x index=%04x type=%04x len=%08x\n", cid, index, type, len); -- 2.11.4.GIT