cfad47cfa3/tads3/vmcrc.h

User picture

Commiter: Nikos Chantziaras

Author: Nikos Chantziaras

Revision: cfad47cfa3


File Size: 672 Bytes

(June 01, 2009 20:54 UTC) Almost 3 years ago

Initial commit.

 
Show/hide line numbers
/* Copyright (c) 2003 by Michael J. Roberts.  All Rights Reserved. */
/*
Name
  vmcrc.h - compute a CRC-32 checksum of a data stream
Function
  
Notes
  
Modified
  06/21/03 MJRoberts  - Creation
*/

#ifndef VMCRC_H
#define VMCRC_H

#include <stdlib.h>

class CVmCRC32
{
public:
    CVmCRC32()
    {
        /* start with zero in the accumulator */
        acc_ = 0;
    }

    /* add the given buffer into the checksum */
    void scan_bytes(const void *ptr, size_t len);

    /* retrieve the current checksum value */
    unsigned long get_crc_val() const { return acc_; }

protected:
    /* the checksum accumulator */
    unsigned long acc_;
};


#endif /* VMCRC_H */