Created
January 27, 2017 07:16
-
-
Save alejolp/f747c66dccec1a7c919c14b482544fe3 to your computer and use it in GitHub Desktop.
Test program for ADLER32 Combine function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Calculate the ADLER32 of a sequence of bytes by chunks, allowing to | |
| * use threads to speed up the calculations. | |
| * | |
| * By Alejandro Santos <alejandro.santos@cern.ch> | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <memory.h> | |
| #include <zlib.h> | |
| #if 0 | |
| #define DATA1 "a" | |
| #define DATA2 "b" | |
| #else | |
| #define DATA1 "QWER" | |
| #define DATA2 "ASDF" | |
| #endif | |
| int main(int argc, char** argv) { | |
| (void)argc; | |
| (void)argv; | |
| const char* buffer1 = DATA1; | |
| const char* buffer2 = DATA2; | |
| const char* buffer3 = DATA1 DATA2; | |
| unsigned int len1 = strlen(buffer1); | |
| unsigned int len2 = strlen(buffer2); | |
| unsigned int len3 = strlen(buffer3); | |
| uLong a1 = adler32(1L, (const Bytef *)buffer1, len1); | |
| uLong a2 = adler32(1L, (const Bytef *)buffer2, len2); | |
| uLong a3 = adler32(1L, (const Bytef *)buffer3, len3); | |
| uLong acomb = adler32_combine(a1, a2, len2); | |
| printf("adler32 buffer1: %u, %lx\n", len1, a1); | |
| printf("adler32 buffer2: %u, %lx\n", len2, a2); | |
| printf("adler32 buffer3: %u, %lx\n", len3, a3); | |
| printf("adler32_combine: %lx\n", acomb); | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment