Changeset f369a50 in rtems


Ignore:
Timestamp:
Mar 18, 2011, 10:11:04 AM (8 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.11, master
Children:
676506f3
Parents:
673df40c
Message:

Import from zlib-1.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/zlib/adler32.c

    r673df40c rf369a50  
    11/* adler32.c -- compute the Adler-32 checksum of a data stream
    2  * Copyright (C) 1995-2004 Mark Adler
     2 * Copyright (C) 1995-2007 Mark Adler
    33 * For conditions of distribution and use, see copyright notice in zlib.h
    44 */
     
    66/* @(#) $Id$ */
    77
    8 #define ZLIB_INTERNAL
    9 #include "zlib.h"
     8#include "zutil.h"
     9
     10#define local static
     11
     12local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
    1013
    1114#define BASE 65521UL    /* largest prime smaller than 65536 */
     
    126129
    127130/* ========================================================================= */
    128 uLong ZEXPORT adler32_combine(adler1, adler2, len2)
     131local uLong adler32_combine_(adler1, adler2, len2)
    129132    uLong adler1;
    130133    uLong adler2;
    131     z_off_t len2;
     134    z_off64_t len2;
    132135{
    133136    unsigned long sum1;
     
    142145    sum1 += (adler2 & 0xffff) + BASE - 1;
    143146    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
    144     if (sum1 > BASE) sum1 -= BASE;
    145     if (sum1 > BASE) sum1 -= BASE;
    146     if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
    147     if (sum2 > BASE) sum2 -= BASE;
     147    if (sum1 >= BASE) sum1 -= BASE;
     148    if (sum1 >= BASE) sum1 -= BASE;
     149    if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
     150    if (sum2 >= BASE) sum2 -= BASE;
    148151    return sum1 | (sum2 << 16);
    149152}
     153
     154/* ========================================================================= */
     155uLong ZEXPORT adler32_combine(adler1, adler2, len2)
     156    uLong adler1;
     157    uLong adler2;
     158    z_off_t len2;
     159{
     160    return adler32_combine_(adler1, adler2, len2);
     161}
     162
     163uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
     164    uLong adler1;
     165    uLong adler2;
     166    z_off64_t len2;
     167{
     168    return adler32_combine_(adler1, adler2, len2);
     169}
Note: See TracChangeset for help on using the changeset viewer.