From: Michael Gernoth Date: Mon, 2 Feb 2009 22:55:08 +0000 (+0100) Subject: remove last register named variables. now it's readable and even still works :-) X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/56a9a862f25a794fc7ef28f7a109762fe01d0c7c?ds=sidebyside remove last register named variables. now it's readable and even still works :-) --- diff --git a/rsb-lz.c b/rsb-lz.c index 7b94aef..93e9d79 100644 --- a/rsb-lz.c +++ b/rsb-lz.c @@ -98,45 +98,39 @@ void write_byte(unsigned char byte, struct data_out_s *data_out) data_out->pos++; } -void lz_expand(struct data_in_s *r10_data, struct data_out_s *data_out) +void lz_expand(struct data_in_s *data_in, struct data_out_s *data_out) { - unsigned int r5; - unsigned int r2; - unsigned char r4; - unsigned int r6; - unsigned int r7; - unsigned int r11; - unsigned char window[1024]; + unsigned int pos; + unsigned int offset; + unsigned int i; + unsigned char byte; + unsigned int num; + unsigned char buf[1024]; - r5 = 1; + pos = 1; while (1) { while (1) { - r2 = get_next_bit(r10_data); - if (r2 == 0) + if (get_next_bit(data_in) == 0) break; - r2 = get_next_bits(r10_data, 8) & 0xff; + byte = get_next_bits(data_in, 8); - write_byte(r2, data_out); - window[r5] = r2 & 0xff; - r5 = (r5 + 1) & 0x3ff; + write_byte(byte, data_out); + buf[pos] = byte; + pos = (pos + 1) & 0x3ff; } - r11 = get_next_bits(r10_data, 0x0a); - if(r11 == 0) + offset = get_next_bits(data_in, 0x0a); + if(offset == 0) return; - r2 = get_next_bits(r10_data, 0x04); - r7 = r2 + 1; - r6 = 0; - while (r6 <= r7) { - r2 = (r6 + r11) & 0x3ff; - r4 = window[r2]; - write_byte(r4, data_out); - window[r5] = r4; - r5 = (r5 + 1) & 0x3ff; - r6++; + num = get_next_bits(data_in, 0x04) + 1; + for (i = 0; i <= num; i++) { + byte = buf[(offset + i) & 0x3ff]; + write_byte(byte, data_out); + buf[pos] = byte; + pos = (pos + 1) & 0x3ff; } } }