< prev index next >

src/java.base/share/native/libzip/zlib/zadler32.c

Print this page
*** 29,12 ***
  
  /* @(#) $Id$ */
  
  #include "zutil.h"
  
- local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
- 
  #define BASE 65521U     /* largest prime smaller than 65536 */
  #define NMAX 5552
  /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
  
  #define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
--- 29,10 ---

*** 82,15 ***
  #  define MOD28(a) a %= BASE
  #  define MOD63(a) a %= BASE
  #endif
  
  /* ========================================================================= */
! uLong ZEXPORT adler32_z(adler, buf, len)
-     uLong adler;
-     const Bytef *buf;
-     z_size_t len;
- {
      unsigned long sum2;
      unsigned n;
  
      /* split Adler-32 into component sums */
      sum2 = (adler >> 16) & 0xffff;
--- 80,11 ---
  #  define MOD28(a) a %= BASE
  #  define MOD63(a) a %= BASE
  #endif
  
  /* ========================================================================= */
! uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
      unsigned long sum2;
      unsigned n;
  
      /* split Adler-32 into component sums */
      sum2 = (adler >> 16) & 0xffff;

*** 153,24 ***
      /* return recombined sums */
      return adler | (sum2 << 16);
  }
  
  /* ========================================================================= */
! uLong ZEXPORT adler32(adler, buf, len)
-     uLong adler;
-     const Bytef *buf;
-     uInt len;
- {
      return adler32_z(adler, buf, len);
  }
  
  /* ========================================================================= */
! local uLong adler32_combine_(adler1, adler2, len2)
-     uLong adler1;
-     uLong adler2;
-     z_off64_t len2;
- {
      unsigned long sum1;
      unsigned long sum2;
      unsigned rem;
  
      /* for negative len, return invalid adler32 as a clue for debugging */
--- 147,16 ---
      /* return recombined sums */
      return adler | (sum2 << 16);
  }
  
  /* ========================================================================= */
! uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
      return adler32_z(adler, buf, len);
  }
  
  /* ========================================================================= */
! local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
      unsigned long sum1;
      unsigned long sum2;
      unsigned rem;
  
      /* for negative len, return invalid adler32 as a clue for debugging */

*** 191,20 ***
      if (sum2 >= BASE) sum2 -= BASE;
      return sum1 | (sum2 << 16);
  }
  
  /* ========================================================================= */
! uLong ZEXPORT adler32_combine(adler1, adler2, len2)
-     uLong adler1;
-     uLong adler2;
-     z_off_t len2;
- {
      return adler32_combine_(adler1, adler2, len2);
  }
  
! uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
-     uLong adler1;
-     uLong adler2;
-     z_off64_t len2;
- {
      return adler32_combine_(adler1, adler2, len2);
  }
--- 177,12 ---
      if (sum2 >= BASE) sum2 -= BASE;
      return sum1 | (sum2 << 16);
  }
  
  /* ========================================================================= */
! uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
      return adler32_combine_(adler1, adler2, len2);
  }
  
! uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
      return adler32_combine_(adler1, adler2, len2);
  }
< prev index next >