]> git.zerfleddert.de Git - rsbs2/commitdiff
all functions now have meaningful names
authorMichael Gernoth <michael@gernoth.net>
Mon, 2 Feb 2009 22:30:52 +0000 (23:30 +0100)
committerMichael Gernoth <michael@gernoth.net>
Mon, 2 Feb 2009 22:30:52 +0000 (23:30 +0100)
rsb-lz.c

index 5f290d8fdad2bc4e71adc8dccdfb007d934398a7..7b94aef32eee61587a2866bc23a211a7c8b8d4cc 100644 (file)
--- a/rsb-lz.c
+++ b/rsb-lz.c
@@ -15,10 +15,10 @@ void err_exit(const char *fname)
 }
 
 struct data_in_s {
-       unsigned char *start; /* 0 */
-       unsigned char *stop; /* 4 */
-       unsigned char bitpos; /* 8 */
-       unsigned char byte; /* 9 */
+       unsigned char *start;
+       unsigned char *stop;
+       unsigned char bitpos;
+       unsigned char byte;
 };
 
 struct data_out_s {
@@ -39,52 +39,53 @@ unsigned char get_next_in_byte(struct data_in_s *data_in)
        return byte;
 }
 
-unsigned char fn_59848(struct data_in_s *data_in)
+unsigned char get_next_bit(struct data_in_s *data_in)
 {
-       unsigned char r5;
+       unsigned char bitval;
 
        if (data_in->bitpos == 0x80) {
                data_in->byte = get_next_in_byte(data_in);
        }
 
-       r5 = data_in->bitpos & data_in->byte;
+       bitval = data_in->bitpos & data_in->byte;
 
        data_in->bitpos >>= 1;
        if (data_in->bitpos == 0) {
                data_in->bitpos = 0x80;
        }
 
-       if (r5 == 0)
+       if (bitval == 0)
                return 0;
 
        return 1;
 }
 
-unsigned int fn_598b4(struct data_in_s *r11_data, unsigned int r10_arg2)
+unsigned int get_next_bits(struct data_in_s *data_in, unsigned int bits)
 {
-       unsigned int r6;
-       unsigned int r7;
+       unsigned int bit;
+       unsigned int next_bits;
 
-       r6 = 1 << (r10_arg2 - 1);
+       bit = 1 << (bits - 1);
 
-       r7 = 0;
-       while (r6 != 0) {
-               if (r11_data->bitpos == 0x80) {
-                       r11_data->byte = get_next_in_byte(r11_data);
+       next_bits = 0;
+       while (bit != 0) {
+               if (data_in->bitpos == 0x80) {
+                       data_in->byte = get_next_in_byte(data_in);
                }
-               if ((r11_data->bitpos & r11_data->byte) != 0)
-                       r7 = r7 | r6;
 
-               r6 = r6 >> 1;
+               if ((data_in->bitpos & data_in->byte) != 0)
+                       next_bits = next_bits | bit;
+
+               bit = bit >> 1;
 
-               r11_data->bitpos >>= 1;
+               data_in->bitpos >>= 1;
 
-               if(r11_data->bitpos == 0) {
-                       r11_data->bitpos = 0x80;
+               if(data_in->bitpos == 0) {
+                       data_in->bitpos = 0x80;
                }
        }
 
-       return r7;
+       return next_bits;
 }
 
 void write_byte(unsigned char byte, struct data_out_s *data_out)
@@ -105,35 +106,35 @@ void lz_expand(struct data_in_s *r10_data, struct data_out_s *data_out)
        unsigned int r6;
        unsigned int r7;
        unsigned int r11;
-       unsigned char arr_59b64[1024];
+       unsigned char window[1024];
 
        r5 = 1;
 
        while (1) {
                while (1) {
-                       r2 = fn_59848(r10_data);
+                       r2 = get_next_bit(r10_data);
                        if (r2 == 0)
                                break;
 
-                       r2 = fn_598b4(r10_data, 8) & 0xff;
+                       r2 = get_next_bits(r10_data, 8) & 0xff;
 
                        write_byte(r2, data_out);
-                       arr_59b64[r5] = r2 & 0xff;
+                       window[r5] = r2 & 0xff;
                        r5 = (r5 + 1) & 0x3ff;
                }
 
-               r11 = fn_598b4(r10_data, 0x0a);
+               r11 = get_next_bits(r10_data, 0x0a);
                if(r11 == 0)
                        return;
 
-               r2 = fn_598b4(r10_data, 0x04);
+               r2 = get_next_bits(r10_data, 0x04);
                r7 = r2 + 1;
                r6 = 0;
                while (r6 <= r7) {
                        r2 = (r6 + r11) & 0x3ff;
-                       r4 = arr_59b64[r2];
+                       r4 = window[r2];
                        write_byte(r4, data_out);
-                       arr_59b64[r5] = r4;
+                       window[r5] = r4;
                        r5 = (r5 + 1) & 0x3ff;
                        r6++;
                }
Impressum, Datenschutz