Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: src/platform/vboot_reference/vboot_firmware/lib/cgptlib/crc32.c

Issue 2303003: Moved cgptlib into vboot_firmware (Closed) Base URL: ssh://gitrw.chromium.org/chromiumos
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* CRC32 implementation by Gary S. Brown. See license claim below. */ 1 /* CRC32 implementation by Gary S. Brown. See license claim below. */
2 2
3 /* ============================================================= */ 3 /* ============================================================= */
4 /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ 4 /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */
5 /* code or tables extracted from it, as desired without restriction. */ 5 /* code or tables extracted from it, as desired without restriction. */
6 /* */ 6 /* */
7 /* First, the polynomial itself and its table of feedback terms. The */ 7 /* First, the polynomial itself and its table of feedback terms. The */
8 /* polynomial is */ 8 /* polynomial is */
9 /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ 9 /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
10 /* */ 10 /* */
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 /* Returns a 32-bit CRC of the contents of the buffer. */ 100 /* Returns a 32-bit CRC of the contents of the buffer. */
101 uint32_t Crc32(const void *buffer, uint32_t len) { 101 uint32_t Crc32(const void *buffer, uint32_t len) {
102 uint8_t *byte = (uint8_t*)buffer; 102 uint8_t *byte = (uint8_t*)buffer;
103 uint32_t i; 103 uint32_t i;
104 uint32_t value = ~0U; 104 uint32_t value = ~0U;
105 105
106 for (i = 0; i < len; ++i) 106 for (i = 0; i < len; ++i)
107 value = crc32_tab[(value ^ byte[i]) & 0xff] ^ (value >> 8); 107 value = crc32_tab[(value ^ byte[i]) & 0xff] ^ (value >> 8);
108 return value ^ ~0U; 108 return value ^ ~0U;
109 } 109 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698