wdvi

network DVI viewer
Log | Files | Refs

commit 45c819c32aa4af91b40dbca82734cd83c8795328
parent c51aa30b9e96e3817c95d0e0938de7a7b2cb5b33
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Thu,  9 Mar 2023 03:35:00 +0000

cleanup sample()

- ansi function prototypes
- indentation
- if statement bodies on newline

Diffstat:
Mdvi-draw.c | 40++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/dvi-draw.c b/dvi-draw.c @@ -329,9 +329,7 @@ static char sample_count[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; static int -sample(bits, bytes_wide, bit_skip, w, h) - BMUNIT *bits; - int bytes_wide, bit_skip, w, h; +sample(BMUNIT *bits, int bytes_wide, int bit_skip, int w, int h) { BMUNIT *ptr, *endp; BMUNIT *cp; @@ -349,30 +347,32 @@ sample(bits, bytes_wide, bit_skip, w, h) n = 0; while (bits_left) { #ifndef WORDS_BIGENDIAN - wid = BMBITS - bit_shift; + wid = BMBITS - bit_shift; #else - wid = bit_shift; + wid = bit_shift; #endif - if (wid > bits_left) wid = bits_left; - if (wid > 4) wid = 4; + if (wid > bits_left) + wid = bits_left; + if (wid > 4) + wid = 4; #ifdef WORDS_BIGENDIAN - bit_shift -= wid; + bit_shift -= wid; #endif - for (cp = ptr; cp < endp; cp = ADD(cp, bytes_wide)) - n += sample_count[(*cp >> bit_shift) & bit_masks[wid]]; + for (cp = ptr; cp < endp; cp = ADD(cp, bytes_wide)) + n += sample_count[(*cp >> bit_shift) & bit_masks[wid]]; #ifndef WORDS_BIGENDIAN - bit_shift += wid; - if (bit_shift == BMBITS) { - bit_shift = 0; - ++ptr; - } + bit_shift += wid; + if (bit_shift == BMBITS) { + bit_shift = 0; + ++ptr; + } #else - if (bit_shift == 0) { - bit_shift = BMBITS; - ++ptr; - } + if (bit_shift == 0) { + bit_shift = BMBITS; + ++ptr; + } #endif - bits_left -= wid; + bits_left -= wid; } return n; }