From: H. Peter Anvin Date: Tue, 4 Mar 2008 01:43:41 +0000 (-0800) Subject: VESA: Simplify the lss16 decoder X-Git-Tag: syslinux-3.70-pre4~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=302eba2d7e3e4bd3a01d5bb102a6180e159062b3;p=platform%2Fupstream%2Fsyslinux.git VESA: Simplify the lss16 decoder Simplify the lss16 decoder slightly. --- diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c index d914b53..f6b7b77 100644 --- a/com32/lib/sys/vesa/background.c +++ b/com32/lib/sys/vesa/background.c @@ -284,7 +284,6 @@ static int read_lss16_file(FILE *fp, const void *header, int header_len) st_c0, st_c1, st_c2, - st_run, } state; int i, x, y; uint32_t *bgptr = (void *)__vesacon_background; @@ -310,7 +309,8 @@ static int read_lss16_file(FILE *fp, const void *header, int header_len) color = colors[prev = 0]; /* By specification */ count = 0; - for (x = 0; x < h->xsize;) { + x = 0; + while (x < h->xsize) { if (!has_nybble) { if (fread(&byte, 1, 1, fp) != 1) return -1; @@ -336,7 +336,7 @@ static int read_lss16_file(FILE *fp, const void *header, int header_len) state = st_c1; } else { count = nybble; - state = st_run; + goto do_run; } break; @@ -347,20 +347,15 @@ static int read_lss16_file(FILE *fp, const void *header, int header_len) case st_c2: count += nybble << 4; - state = st_run; - break; + goto do_run; - case st_run: - /* Can't happen */ - break; - } - - if (state == st_run) { + do_run: count = min(count, h->xsize-x); x += count; asm volatile("rep; stosl" : "+D" (bgptr), "+c" (count) : "a" (color)); state = st_start; + break; } }