Thread: C code

  1. #1
    Registered User
    Join Date
    Nov 2008

    C code

    Adler-32 here is a code in zlib manual
    uLong adler;    //  adler32 value of the uncompressed data 
       uLong adler32 (uLong adler, const Bytef *buf, uInt len); 
    Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. 
    An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: 
         uLong adler = adler32(0L, Z_NULL, 0);
         while (read_buffer(buffer, length) != EOF) {
           adler = adler32(adler, buffer, length);
         if (adler != original_adler) error();
    how adler32 works and help me to understand the code

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Well, without seeing the actual code for "adler32", I have no idea how it works.;

    Wikipedia has this article, which may help:

    If you have specific questions, please ask those, not "how does this work", as it would take quite a bit of our time to answer something that you possibly already know, and completely miss the actual point you are asking for.

    Also, when you have code-tags, try to either break the lines yourself, or put comments regarding the code OUTSIDE the code-tags, as there is no automatic line-breaks inside code-tags, and it makes the text very hard to read.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Basically a continuation of this -
    If all you're going to do is go through the zlib code base, and post snippets of it with "what does this do", then you're in for a surprise.

    Start by visiting the home page, read all the documentation, and read up on compression theory.
    Then spend a few months learning C, to the point you can reasonably read most code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM