Deleted Added
full compact
archive_crc32.h (228763) archive_crc32.h (232153)
1/*-
2 * Copyright (c) 2009 Joerg Sonnenberger
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 8 unchanged lines hidden (view full) ---

17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
1/*-
2 * Copyright (c) 2009 Joerg Sonnenberger
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 8 unchanged lines hidden (view full) ---

17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * $FreeBSD: head/contrib/libarchive/libarchive/archive_crc32.h 228763 2011-12-21 11:13:29Z mm $
25 * $FreeBSD: head/contrib/libarchive/libarchive/archive_crc32.h 232153 2012-02-25 10:58:02Z mm $
26 */
27
28#ifndef __LIBARCHIVE_BUILD
29#error This header is only to be used internally to libarchive.
30#endif
31
32/*
33 * When zlib is unavailable, we should still be able to validate

--- 21 unchanged lines hidden (view full) ---

55 crc2 = (crc2 >> 1);
56 }
57 crc_tbl[b] = crc2;
58 }
59 crc_tbl_inited = 1;
60 }
61
62 crc = crc ^ 0xffffffffUL;
26 */
27
28#ifndef __LIBARCHIVE_BUILD
29#error This header is only to be used internally to libarchive.
30#endif
31
32/*
33 * When zlib is unavailable, we should still be able to validate

--- 21 unchanged lines hidden (view full) ---

55 crc2 = (crc2 >> 1);
56 }
57 crc_tbl[b] = crc2;
58 }
59 crc_tbl_inited = 1;
60 }
61
62 crc = crc ^ 0xffffffffUL;
63 /* A use of this loop is about 20% - 30% faster than
64 * no use version in any optimization option of gcc. */
65 for (;len >= 8; len -= 8) {
66 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
67 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
68 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
69 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
70 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
71 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
72 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
73 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
74 }
63 while (len--)
64 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
65 return (crc ^ 0xffffffffUL);
66}
75 while (len--)
76 crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
77 return (crc ^ 0xffffffffUL);
78}