Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/libbb/crc32.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/libbb/crc32.c
r821 r1770 7 7 * 8 8 * The following function creates a CRC32 table depending on whether 9 * a big-endian (0x04c11db7) or little-endian (0xedb88320) CRC32 is 9 * a big-endian (0x04c11db7) or little-endian (0xedb88320) CRC32 is 10 10 * required. Admittedly, there are other CRC32 polynomials floating 11 11 * around, but Busybox doesn't use them. … … 15 15 */ 16 16 17 #include <stdio.h>18 #include <stdlib.h>19 17 #include "libbb.h" 20 18 21 uint32_t *bb_crc32_filltable (int endian) { 22 23 uint32_t *crc_table = xmalloc(256 * sizeof(uint32_t)); 19 uint32_t *crc32_filltable(uint32_t *crc_table, int endian) 20 { 24 21 uint32_t polynomial = endian ? 0x04c11db7 : 0xedb88320; 25 22 uint32_t c; 26 23 int i, j; 27 24 25 if (!crc_table) 26 crc_table = xmalloc(256 * sizeof(uint32_t)); 27 28 28 for (i = 0; i < 256; i++) { 29 29 c = endian ? (i << 24) : i;
Note:
See TracChangeset
for help on using the changeset viewer.