Annotation of uae/src/crc32.c, revision 1.1

1.1     ! root        1: 
        !             2: #include "sysconfig.h"
        !             3: #include "sysdeps.h"
        !             4: 
        !             5: static unsigned long crc_table[256];
        !             6: static void make_crc_table()
        !             7: {
        !             8:     unsigned long c;
        !             9:     int n, k;
        !            10:     for (n = 0; n < 256; n++)
        !            11:     {
        !            12:        c = (unsigned long)n;
        !            13:        for (k = 0; k < 8; k++) c = (c >> 1) ^ (c & 1 ? 0xedb88320 : 0);
        !            14:            crc_table[n] = c;
        !            15:     }
        !            16: }
        !            17: uae_u32 get_crc32 (uae_u8 *buf, int len)
        !            18: {
        !            19:     uae_u32 crc;
        !            20:     if (!crc_table[1])
        !            21:        make_crc_table();
        !            22:     crc = 0xffffffff;
        !            23:     while (len-- > 0) {
        !            24:        crc = crc_table[(crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
        !            25:     }
        !            26:     return crc ^ 0xffffffff;
        !            27: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.