adler32.c File Reference

#include "common.h"
#include "adler32.h"

Go to the source code of this file.

Defines

#define BASE   65521L
#define DO1(buf)   {s1 += *buf++; s2 += s1;}
#define DO4(buf)   DO1(buf); DO1(buf); DO1(buf); DO1(buf);
#define DO16(buf)   DO4(buf); DO4(buf); DO4(buf); DO4(buf);

Functions

unsigned long av_adler32_update (unsigned long adler, const uint8_t *buf, unsigned int len)


Define Documentation

#define BASE   65521L

Definition at line 26 of file adler32.c.

Referenced by av_adler32_update().

#define DO1 ( buf   )     {s1 += *buf++; s2 += s1;}

Definition at line 28 of file adler32.c.

Referenced by av_adler32_update().

#define DO16 ( buf   )     DO4(buf); DO4(buf); DO4(buf); DO4(buf);

Definition at line 30 of file adler32.c.

Referenced by av_adler32_update().

#define DO4 ( buf   )     DO1(buf); DO1(buf); DO1(buf); DO1(buf);

Definition at line 29 of file adler32.c.

Referenced by av_adler32_update().


Function Documentation

unsigned long av_adler32_update ( unsigned long  adler,
const uint8_t *  buf,
unsigned int  len 
)

Definition at line 32 of file adler32.c.

References av_adler32_update(), av_log(), AV_LOG_DEBUG, av_log_level, BASE, DO1, DO16, DO4, main(), NULL, s1, s2, START_TIMER, and STOP_TIMER.

Referenced by av_adler32_update(), crc_write_packet(), and framecrc_write_packet().

00033 {
00034     unsigned long s1 = adler & 0xffff;
00035     unsigned long s2 = adler >> 16;
00036 
00037     while (len>0) {
00038 #ifdef CONFIG_SMALL
00039         while(len>4 && s2 < (1U<<31)){
00040             DO4(buf); len-=4;
00041 #else
00042         while(len>16 && s2 < (1U<<31)){
00043             DO16(buf); len-=16;
00044 #endif
00045         }
00046         DO1(buf); len--;
00047         s1 %= BASE;
00048         s2 %= BASE;
00049     }
00050     return (s2 << 16) | s1;
00051 }


Generated on Sat Oct 11 19:45:03 2008 for libextractor by  doxygen 1.5.1