annotate lib/crc.h @ 11583:dc80f2cc1327

Second attempt to work around an AIX 5.3, 6.1 compiler bug with include_next.
author Eric Blake <ebb9@byu.net>
date Thu, 21 May 2009 16:48:12 +0200
parents bbbbbf4cd1c5
children b5e42ef33b49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6357
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
1 /* crc.h -- cyclic redundancy checks
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
2 Copyright (C) 2005 Free Software Foundation, Inc.
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6421
diff changeset
4 This program is free software: you can redistribute it and/or modify
6357
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6421
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6421
diff changeset
7 (at your option) any later version.
6357
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
8
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
12 GNU General Public License for more details.
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
13
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6421
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
6357
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
16
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
17 /* Written by Simon Josefsson. */
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
18
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
19 #ifndef CRC_H
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
20 # define CRC_H 1
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
21
6421
36fc37878824 * crc.h: Include stddef.h, for size_t.
Simon Josefsson <simon@josefsson.org>
parents: 6406
diff changeset
22 #include <stddef.h>
6406
edea0771ea6b * crc.h: Include stdint.h directly, suggested by Bruno Haible
Simon Josefsson <simon@josefsson.org>
parents: 6357
diff changeset
23 #include <stdint.h>
6357
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
24
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
25 /* Compute CRC-32 value of LEN bytes long BUF, and return it. */
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
26 extern uint32_t crc32 (const char *buf, size_t len);
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
27
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
28 /* Incrementally update CRC-32 value CRC using LEN bytes long BUF. In
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
29 the first call, use 0 as the value for CRC. Return the updated
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
30 CRC-32 value. */
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
31 extern uint32_t crc32_update (uint32_t crc, const char *buf, size_t len);
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
32
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
33 /* Compute modified-CRC-32 value of LEN bytes long BUF, and return it.
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
34 The "modification" is to avoid the initial and final XOR operation.
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
35 Due to historic implementation errors, this variant is sometimes
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
36 used (i.e., in RFC 3961). */
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
37 extern uint32_t crc32_no_xor (const char *buf, size_t len);
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
38
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
39 /* Incrementally update modified-CRC-32 value CRC using LEN bytes long
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
40 BUF. In the first call, use 0 as the value for CRC. Return the
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
41 updated modified-CRC-32 value. The "modification" is to avoid the
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
42 initial and final XOR operation. Due to historic implementation
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
43 errors, this variant is sometimes used (i.e., in RFC 3961). */
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
44 extern uint32_t
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
45 crc32_update_no_xor (uint32_t crc, const char *buf, size_t len);
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
46
9abdb1386cc0 Add crc module.
Simon Josefsson <simon@josefsson.org>
parents:
diff changeset
47 #endif /* CRC_H */