Mercurial > hg > nginx-quic
comparison src/core/ngx_crc.h @ 441:da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 28 Sep 2004 08:34:51 +0000 |
parents | 0b67be7d4489 |
children | 42d11f017717 |
comparison
equal
deleted
inserted
replaced
440:f390d1775430 | 441:da8c5707af39 |
---|---|
1 | |
2 /* | |
3 * Copyright (C) 2002-2004 Igor Sysoev | |
4 */ | |
5 | |
6 | |
1 #ifndef _NGX_CRC_H_INCLUDED_ | 7 #ifndef _NGX_CRC_H_INCLUDED_ |
2 #define _NGX_CRC_H_INCLUDED_ | 8 #define _NGX_CRC_H_INCLUDED_ |
3 | 9 |
4 | 10 |
5 /* 32-bit crc16 */ | 11 /* 32-bit crc16 */ |
7 ngx_inline static uint32_t ngx_crc(char *data, size_t len) | 13 ngx_inline static uint32_t ngx_crc(char *data, size_t len) |
8 { | 14 { |
9 uint32_t sum; | 15 uint32_t sum; |
10 | 16 |
11 for (sum = 0; len; len--) { | 17 for (sum = 0; len; len--) { |
18 | |
12 /* | 19 /* |
13 * gcc 2.95.2 x86 and icc 7.1.006 compile that operator | 20 * gcc 2.95.2 x86 and icc 7.1.006 compile that operator |
14 * into the single rol opcode. | 21 * into the single "rol" opcode. |
15 * msvc 6.0sp2 compiles it into four opcodes. | 22 * msvc 6.0sp2 compiles it into four opcodes. |
16 */ | 23 */ |
17 sum = sum >> 1 | sum << 31; | 24 sum = sum >> 1 | sum << 31; |
18 | 25 |
19 sum += *data++; | 26 sum += *data++; |