mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
rename ngx_crc32_init() to ngx_crc32_table_init()
ngx_crc32_init(), ngx_crc32_update(), ngx_crc32_final()
This commit is contained in:
parent
27dd6a62bd
commit
ac7586e952
@ -273,9 +273,11 @@ main(int argc, char *const *argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ngx_crc32_init() requires ngx_cacheline_size set in ngx_os_init() */
|
||||
/*
|
||||
* ngx_crc32_table_init() requires ngx_cacheline_size set in ngx_os_init()
|
||||
*/
|
||||
|
||||
if (ngx_crc32_init() != NGX_OK) {
|
||||
if (ngx_crc32_table_init() != NGX_OK) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ uint32_t *ngx_crc32_table_short = ngx_crc32_table16;
|
||||
|
||||
|
||||
ngx_int_t
|
||||
ngx_crc32_init(void)
|
||||
ngx_crc32_table_init(void)
|
||||
{
|
||||
void *p;
|
||||
|
||||
|
@ -49,7 +49,30 @@ ngx_crc32_long(u_char *p, size_t len)
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t ngx_crc32_init(void);
|
||||
#define ngx_crc32_init(crc) \
|
||||
crc = 0xffffffff
|
||||
|
||||
|
||||
static void
|
||||
ngx_crc32_update(uint32_t *crc, u_char *p, size_t len)
|
||||
{
|
||||
uint32_t c;
|
||||
|
||||
c = *crc;
|
||||
|
||||
while (len--) {
|
||||
c = ngx_crc32_table256[(c ^ *p++) & 0xff] ^ (c >> 8);
|
||||
}
|
||||
|
||||
*crc = c;
|
||||
}
|
||||
|
||||
|
||||
#define ngx_crc32_final(crc) \
|
||||
crc ^= 0xffffffff
|
||||
|
||||
|
||||
ngx_int_t ngx_crc32_table_init(void);
|
||||
|
||||
|
||||
#endif /* _NGX_CRC32_H_INCLUDED_ */
|
||||
|
Loading…
Reference in New Issue
Block a user