]> cvs.zerfleddert.de Git - rsbs2/commitdiff
make crc implementation a bit more readable
authorMichael Gernoth <michael@gernoth.net>
Tue, 27 Jan 2009 23:54:58 +0000 (00:54 +0100)
committerMichael Gernoth <michael@gernoth.net>
Tue, 27 Jan 2009 23:54:58 +0000 (00:54 +0100)
rsb-crc.c

index 84b7fa2f3627d3f6dfeea78e836061405a8e85ee..fa40c498099e3b3838e8e325f00b844940287bc1 100644 (file)
--- a/rsb-crc.c
+++ b/rsb-crc.c
  * 4c4: DATA: 0x04c11db7
  */
 
-unsigned int rsb_crc(unsigned int r11, unsigned char *r10, unsigned int r14) {
-       unsigned int r6 = 0;
-       unsigned int r3;
-       int r5;
+unsigned int rsb_crc(unsigned int r11_crc, unsigned char *r10_buf, unsigned int r14_len) {
+       unsigned int r6_pos = 0;
+       unsigned int r3_data;
+       int r5_bit;
 
-       while (r6 < r14) {
-               r3 = (*(r6+r10)) << 24;
-               r11 = r11 ^ r3;
+       while (r6_pos < r14_len) {
+               r3_data = (*(r6_pos+r10_buf)) << 24;
+               r11_crc = r11_crc ^ r3_data;
 
-               r5 = 8;
+               r5_bit = 8;
                
                do {
-                       r3 = r11 & 0x80000000;
+                       r3_data = r11_crc & 0x80000000;
 
-                       if (r3 != 0) {
-                               r3 = r11 << 1;
-                               r11 = r3 ^ POLY;
+                       if (r3_data != 0) {
+                               r3_data = r11_crc << 1;
+                               r11_crc = r3_data ^ POLY;
                        } else {
-                               r11 = r11 << 1;
+                               r11_crc = r11_crc << 1;
                        }
-                       r5--;
-               } while (r5);
+                       r5_bit--;
+               } while (r5_bit);
 
-               r6++;
+               r6_pos++;
        }
 
-       return r11;
+       return r11_crc;
 }
Impressum, Datenschutz