/*
- * Copyright (c) 2008 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
- *
+ *
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* crc32.c -- compute the CRC-32 of a data stream
one thread to use crc32().
*/
+
#ifdef MAKECRCH
# include <stdio.h>
# ifndef DYNAMIC_CRC_TABLE
allow for word-at-a-time CRC calculation for both big-endian and little-
endian machines, where a word is four bytes.
*/
-local void make_crc_table()
+local void
+make_crc_table(void)
{
unsigned long c;
int n, k;
}
#ifdef MAKECRCH
-local void write_table(out, table)
- FILE *out;
- const unsigned long FAR *table;
+local void
+write_table(FILE *out, const unsigned long FAR *table)
{
int n;
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
-const unsigned long FAR * ZEXPORT get_crc_table()
+const unsigned long FAR * ZEXPORT
+get_crc_table(void)
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
/* ========================================================================= */
-unsigned long ZEXPORT z_crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
+unsigned long ZEXPORT
+z_crc32(unsigned long crc, const unsigned char FAR *buf, unsigned len)
{
if (buf == Z_NULL) return 0UL;
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
/* ========================================================================= */
-local unsigned long crc32_little(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
+local unsigned long
+crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len)
{
- register u4 c;
- register const u4 FAR *buf4;
+ u4 c;
+ const u4 FAR *buf4;
c = (u4)crc;
c = ~c;
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
/* ========================================================================= */
-local unsigned long crc32_big(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
+local unsigned long
+crc32_big(unsigned long crc, const unsigned char FAR *buf, unsigned len)
{
- register u4 c;
- register const u4 FAR *buf4;
+ u4 c;
+ const u4 FAR *buf4;
c = REV((u4)crc);
c = ~c;
#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
/* ========================================================================= */
-local unsigned long gf2_matrix_times(mat, vec)
- unsigned long *mat;
- unsigned long vec;
+local unsigned long
+gf2_matrix_times(unsigned long *mat, unsigned long vec)
{
unsigned long sum;
}
/* ========================================================================= */
-local void gf2_matrix_square(square, mat)
- unsigned long *square;
- unsigned long *mat;
+local void
+gf2_matrix_square(unsigned long *square, unsigned long *mat)
{
int n;
}
/* ========================================================================= */
-uLong ZEXPORT z_crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
+uLong ZEXPORT
+z_crc32_combine(uLong crc1, uLong crc2, z_off_t len2)
{
int n;
unsigned long row;