comparison src/core/ngx_crc32.h @ 1694:8c696afe46b3

rename ngx_crc32_init() to ngx_crc32_table_init() ngx_crc32_init(), ngx_crc32_update(), ngx_crc32_final()
author Igor Sysoev <igor@sysoev.ru>
date Fri, 07 Dec 2007 20:19:41 +0000
parents 45df22906c12
children d6afb8723155
comparison
equal deleted inserted replaced
1693:f4eb04fd8579 1694:8c696afe46b3
47 47
48 return crc ^ 0xffffffff; 48 return crc ^ 0xffffffff;
49 } 49 }
50 50
51 51
52 ngx_int_t ngx_crc32_init(void); 52 #define ngx_crc32_init(crc) \
53 crc = 0xffffffff
54
55
56 static void
57 ngx_crc32_update(uint32_t *crc, u_char *p, size_t len)
58 {
59 uint32_t c;
60
61 c = *crc;
62
63 while (len--) {
64 c = ngx_crc32_table256[(c ^ *p++) & 0xff] ^ (c >> 8);
65 }
66
67 *crc = c;
68 }
69
70
71 #define ngx_crc32_final(crc) \
72 crc ^= 0xffffffff
73
74
75 ngx_int_t ngx_crc32_table_init(void);
53 76
54 77
55 #endif /* _NGX_CRC32_H_INCLUDED_ */ 78 #endif /* _NGX_CRC32_H_INCLUDED_ */