Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/crc32.c


Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/libbb/crc32.c

    r1765 r2725  
    1313 * endian = 1: big-endian
    1414 * endian = 0: little-endian
     15 *
     16 * Licensed under GPLv2, see file LICENSE in this source tree.
    1517 */
    1618
    1719#include "libbb.h"
    1820
    19 uint32_t *crc32_filltable(uint32_t *crc_table, int endian)
     21uint32_t *global_crc32_table;
     22
     23uint32_t* FAST_FUNC crc32_filltable(uint32_t *crc_table, int endian)
    2024{
    2125    uint32_t polynomial = endian ? 0x04c11db7 : 0xedb88320;
     
    3943    return crc_table - 256;
    4044}
     45
     46uint32_t FAST_FUNC crc32_block_endian1(uint32_t val, const void *buf, unsigned len, uint32_t *crc_table)
     47{
     48    const void *end = (uint8_t*)buf + len;
     49
     50    while (buf != end) {
     51        val = (val << 8) ^ crc_table[(val >> 24) ^ *(uint8_t*)buf];
     52        buf = (uint8_t*)buf + 1;
     53    }
     54    return val;
     55}
     56
     57uint32_t FAST_FUNC crc32_block_endian0(uint32_t val, const void *buf, unsigned len, uint32_t *crc_table)
     58{
     59    const void *end = (uint8_t*)buf + len;
     60
     61    while (buf != end) {
     62                val = crc_table[(uint8_t)val ^ *(uint8_t*)buf] ^ (val >> 8);
     63        buf = (uint8_t*)buf + 1;
     64    }
     65    return val;
     66}
Note: See TracChangeset for help on using the changeset viewer.