home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / crc.H < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  1.5 KB  |  34 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : crc.h                                                                 //
  12. //  Description: CRC check sum                                                       //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. class KCRC  
  17. {
  18.     unsigned short crctab[256];
  19.  
  20.     typedef enum
  21.     {
  22.                                //                CITT    XMODEM    ARC      
  23.         poly     = 0xA001,     // the poly:        0x1021    0x1021    A001    
  24.         initcrc  = 0x0000,     // init value:    -1        0        0    
  25.         byteswap = true        // bit order:    false    true    true
  26.     };
  27.  
  28. public:
  29.  
  30.     KCRC();
  31.  
  32.     unsigned short Update(unsigned short crc, unsigned char * buffer, int len);
  33. };
  34.