linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms-fPG8STNUNVg@public.gmane.org>
To: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: new: bswap_32.1
Date: Sun, 16 Sep 2012 17:55:35 +0200	[thread overview]
Message-ID: <5055F677.4010708@bfs.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

hi,
attached you will find a new man-page describing the swap_x macros.
These are part of libc. In contrast to htonl() etc they swap bytes
unconditionaly. (handy if you need it.)

re,
 wh

.\"Copyright 2012 walter harms (walter.harms-jNDFPZUTrfTUvfpBxBsQfasoZZ7OtMbqG9Ur7JDdleE@public.gmane.org)
.\"  Distributed under GPL
.TH BSWAP 3  2012-09-16 "GNU" "Linux Programmer's Manual"
.SH NAME
bswap_16, bswap_32, bswap_64 \-  swap bytes
.SH  SYNOPSIS
.nf
.B #include <byteswap.h>
.sp
.BI bswap_16 (x);
.sp
.BI bswap_32 (x);
.sp
.BI bswap_64 (x);
.fi
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.ad l
.sp
.BR bswap_64 ()
.RS
__GNUC__ && __GNUC__ >= 2
.RE
.ad
.SH DESCRIPTION
These is a series off macros that swap all bytes unconditionaly.
.sp
.SH EXAMPLE
This example will swap 01020304 into 04030201.
.nf
#include <stdio.h>
#include <stdint.h>
#include <byteswap.h>

int main()
{
        uint32_t x=0x01020304;
        printf("%08x bswap:%08x\\n",x,bswap_32(x));
        return 0;
}
.fi
.SH "CONFORMING TO"
This is a glibc extension.
.SH SEE ALSO
.BR swap (3),
.BR byteorder (3)


[-- Attachment #2: bswap_32.3 --]
[-- Type: text/plain, Size: 905 bytes --]

.\"Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
.\"  Distributed under GPL
.TH BSWAP 3  2012-09-16 "GNU" "Linux Programmer's Manual"
.SH NAME
bswap_16, bswap_32, bswap_64 \-  swap bytes
.SH  SYNOPSIS
.nf
.B #include <byteswap.h>
.sp
.BI bswap_16 (x);
.sp
.BI bswap_32 (x);
.sp
.BI bswap_64 (x);
.fi
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.ad l
.sp
.BR bswap_64 ()
.RS
__GNUC__ && __GNUC__ >= 2
.RE
.ad
.SH DESCRIPTION
These is a series off macros that swap all bytes unconditionaly.
.sp
.SH EXAMPLE
This example will swap 01020304 into 04030201.
.nf
#include <stdio.h>
#include <stdint.h>
#include <byteswap.h>

int main()
{
        uint32_t x=0x01020304;
        printf("%08x bswap:%08x\\n",x,bswap_32(x));
        return 0;
}
.fi
.SH "CONFORMING TO"
This is a glibc extension.
.SH SEE ALSO
.BR swap (3),
.BR byteorder (3)


                 reply	other threads:[~2012-09-16 15:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5055F677.4010708@bfs.de \
    --to=wharms-fpg8stnunvg@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).