aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa/background.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-03-03 17:43:41 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-03-03 17:43:41 -0800
commit302eba2d7e3e4bd3a01d5bb102a6180e159062b3 (patch)
tree7fd3c17cfdc9f4125f10dbcab05f84f5e9a8d06e /com32/lib/sys/vesa/background.c
parent6a3dfed789e30191406785ad013619984fba6dda (diff)
downloadsyslinux-302eba2d7e3e4bd3a01d5bb102a6180e159062b3.tar.gz
syslinux-302eba2d7e3e4bd3a01d5bb102a6180e159062b3.tar.xz
syslinux-302eba2d7e3e4bd3a01d5bb102a6180e159062b3.zip
VESA: Simplify the lss16 decoder
Simplify the lss16 decoder slightly.
Diffstat (limited to 'com32/lib/sys/vesa/background.c')
-rw-r--r--com32/lib/sys/vesa/background.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index d914b53a..f6b7b779 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;
}
}