annotate lib/byteswap.in.h @ 17409:26a04e61f560

stdio: use __REDIRECT for fwrite, fwrite_unlocked * lib/stdio.in.h (fwrite): When working around bug 11959, use __REDIRECT rather than '#define fwrite(...) ... fwrite (...) ...'. This is a more-targeted way to fix the -Wunused-value issue with clang, and it works with GCC too. Problem with targeting reported by Eric Blake in <http://lists.gnu.org/archive/html/bug-gnulib/2013-05/msg00067.html>. (fwrite_unlocked): Treat like fwrite. I ran into this issue while debugging the fwrite issue.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 15 May 2013 15:52:42 -0700
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* byteswap.h - Byte swapping
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
2 Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc.
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9245
diff changeset
5 This program is free software: you can redistribute it and/or modify
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 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: 9245
diff changeset
7 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: 9245
diff changeset
8 (at your option) any later version.
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 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: 9245
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _GL_BYTESWAP_H
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _GL_BYTESWAP_H
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 /* Given an unsigned 16-bit argument X, return the value corresponding to
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 X with reversed byte order. */
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #define bswap_16(x) ((((x) & 0x00FF) << 8) | \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
24 (((x) & 0xFF00) >> 8))
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 /* Given an unsigned 32-bit argument X, return the value corresponding to
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 X with reversed byte order. */
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
29 (((x) & 0x0000FF00) << 8) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
30 (((x) & 0x00FF0000) >> 8) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
31 (((x) & 0xFF000000) >> 24))
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 /* Given an unsigned 64-bit argument X, return the value corresponding to
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 X with reversed byte order. */
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 #define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
36 (((x) & 0x000000000000FF00ULL) << 40) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
37 (((x) & 0x0000000000FF0000ULL) << 24) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
38 (((x) & 0x00000000FF000000ULL) << 8) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
39 (((x) & 0x000000FF00000000ULL) >> 8) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
40 (((x) & 0x0000FF0000000000ULL) >> 24) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
41 (((x) & 0x00FF000000000000ULL) >> 40) | \
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
42 (((x) & 0xFF00000000000000ULL) >> 56))
9245
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
de761f780257 Rename byteswap_.h to byteswap.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 #endif /* _GL_BYTESWAP_H */