summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-leap-15-6/man3/bswap.3
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 19:43:11 +0000
commitfc22b3d6507c6745911b9dfcc68f1e665ae13dbc (patch)
treece1e3bce06471410239a6f41282e328770aa404a /upstream/opensuse-leap-15-6/man3/bswap.3
parentInitial commit. (diff)
downloadmanpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.tar.xz
manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.zip
Adding upstream version 4.22.0.upstream/4.22.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/opensuse-leap-15-6/man3/bswap.3')
-rw-r--r--upstream/opensuse-leap-15-6/man3/bswap.368
1 files changed, 68 insertions, 0 deletions
diff --git a/upstream/opensuse-leap-15-6/man3/bswap.3 b/upstream/opensuse-leap-15-6/man3/bswap.3
new file mode 100644
index 00000000..31d33846
--- /dev/null
+++ b/upstream/opensuse-leap-15-6/man3/bswap.3
@@ -0,0 +1,68 @@
+.\" Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH bswap 3 2023-03-30 "Linux man-pages 6.04"
+.SH NAME
+bswap_16, bswap_32, bswap_64 \- reverse order of bytes
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <byteswap.h>
+.PP
+.BI "uint16_t bswap_16(uint16_t " x );
+.BI "uint32_t bswap_32(uint32_t " x );
+.BI "uint64_t bswap_64(uint64_t " x );
+.fi
+.SH DESCRIPTION
+These functions return a value in which the order of the bytes
+in their 2-, 4-, or 8-byte arguments is reversed.
+.SH RETURN VALUE
+These functions return the value of their argument with the bytes reversed.
+.SH ERRORS
+These functions always succeed.
+.SH STANDARDS
+GNU.
+.SH EXAMPLES
+The program below swaps the bytes of the 8-byte integer supplied as
+its command-line argument.
+The following shell session demonstrates the use of the program:
+.PP
+.in +4n
+.EX
+$ \fB./a.out 0x0123456789abcdef\fP
+0x123456789abcdef ==> 0xefcdab8967452301
+.EE
+.in
+.SS Program source
+\&
+.\" SRC BEGIN (bswap.c)
+.EX
+#include <byteswap.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[])
+{
+ uint64_t x;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <num>\en", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ x = strtoull(argv[1], NULL, 0);
+ printf("%#" PRIx64 " ==> %#" PRIx64 "\en", x, bswap_64(x));
+
+ exit(EXIT_SUCCESS);
+}
+.EE
+.\" SRC END
+.SH SEE ALSO
+.BR byteorder (3),
+.BR endian (3)