Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

  1. //------------------------------------------------------------------------
  2. // Copyright (C) Sewell Development Corporation, 1994 - 1998.
  3. // Web: www.sewelld.com E-mail: [email protected]
  4. //
  5. // LICENSE: This source code was generated by CrcGen, a product of Sewell
  6. // Development Corporation. Paid-up licensees of CrcGen are authorized to
  7. // use this code on a site-wide basis without restriction as to
  8. // the type of product it is incorporated in, except that it may not be
  9. // resold as stand-alone CRC code, and the copyright notice and license
  10. // agreement must not be removed from the code.
  11. //------------------------------------------------------------------------
  12. // Interface definition for 32-bit CRC (cyclic redundancy check) class:
  13. // Polynomial: 04C11DB7
  14. // Initial CRC register value: FFFFFFFF
  15. // Reflected input and output: Yes
  16. // Inverted final output: Yes
  17. // CRC of string "123456789": CBF43926
  18. class Crc32 {
  19. public:
  20. explicit
  21. Crc32() {
  22. m_crc = 0xFFFFFFFF;
  23. }
  24. explicit
  25. Crc32(unsigned __int32 uiInitialCrc) {
  26. m_crc = uiInitialCrc;
  27. }
  28. Crc32(const void* buffer, unsigned int count) {
  29. m_crc = 0xFFFFFFFF;
  30. Compute(buffer, count);
  31. }
  32. void Compute(const void* buffer, unsigned int count);
  33. void Compute(unsigned char value);
  34. operator unsigned __int32 () const {
  35. return m_crc ^ 0xFFFFFFFF;
  36. }
  37. private:
  38. unsigned __int32 m_crc;
  39. };