Changeset 673df40c in rtems


Ignore:
Timestamp:
Mar 18, 2011, 10:11:03 AM (9 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.11, master
Children:
f369a50
Parents:
c6b49cb
Message:

Import from zlib-1.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/zlib/crc32.c

    rc6b49cb r673df40c  
    11/* crc32.c -- compute the CRC-32 of a data stream
    2  * Copyright (C) 1995-2005 Mark Adler
     2 * Copyright (C) 1995-2006 Mark Adler
    33 * For conditions of distribution and use, see copyright notice in zlib.h
    44 *
     
    5454/* Definitions for doing the crc four data bytes at a time. */
    5555#ifdef BYFOUR
    56 #  define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
     56#  define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
    5757                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
    5858   local unsigned long crc32_little OF((unsigned long,
     
    6969                                         unsigned long vec));
    7070local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
     71local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
     72
    7173
    7274#ifdef DYNAMIC_CRC_TABLE
     
    368370
    369371/* ========================================================================= */
    370 uLong ZEXPORT crc32_combine(crc1, crc2, len2)
     372local uLong crc32_combine_(crc1, crc2, len2)
    371373    uLong crc1;
    372374    uLong crc2;
    373     z_off_t len2;
     375    z_off64_t len2;
    374376{
    375377    int n;
     
    378380    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
    379381
    380     /* degenerate case */
    381     if (len2 == 0)
     382    /* degenerate case (also disallow negative lengths) */
     383    if (len2 <= 0)
    382384        return crc1;
    383385
    384386    /* put operator for one zero bit in odd */
    385     odd[0] = 0xedb88320L;           /* CRC-32 polynomial */
     387    odd[0] = 0xedb88320UL;          /* CRC-32 polynomial */
    386388    row = 1;
    387389    for (n = 1; n < GF2_DIM; n++) {
     
    422424    return crc1;
    423425}
     426
     427/* ========================================================================= */
     428uLong ZEXPORT crc32_combine(crc1, crc2, len2)
     429    uLong crc1;
     430    uLong crc2;
     431    z_off_t len2;
     432{
     433    return crc32_combine_(crc1, crc2, len2);
     434}
     435
     436uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
     437    uLong crc1;
     438    uLong crc2;
     439    z_off64_t len2;
     440{
     441    return crc32_combine_(crc1, crc2, len2);
     442}
Note: See TracChangeset for help on using the changeset viewer.