.\" a few pieces remain from an earlier version
.\" Copyright (C) 2008, Nanno Langstraat <nal@ii.nl>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\"*******************************************************************
.\"
.\"*******************************************************************
.TH ENDIAN 3 2010\-09\-10 GNU "Linux Programmer's Manual"
.SH 名前
-htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh,
-htobe64, htole64, be64toh, le64toh \- convert values between host and
-big\-/little\-endian byte order
+htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh,
+le32toh, htobe64, htole64, be64toh, le64toh \- ホストバイトオーダーと
+ビッグ/リトルエンディアンバイトオーダーの間で値の変換を行う
.SH 書式
.nf
-\fB#define _BSD_SOURCE\fP /* See feature_test_macros(7) */
+\fB#define _BSD_SOURCE\fP /* feature_test_macros(7) 参照 */
\fB#include <endian.h>\fP
\fBuint16_t htobe16(uint16_t \fP\fIhost_16bits\fP\fB);\fP
\fBuint64_t le64toh(uint64_t \fP\fIlittle_endian_64bits\fP\fB);\fP
.fi
.SH 説明
-These functions convert the byte encoding of integer values from the byte
-order that the current CPU (the "host") uses, to and from little\-endian and
-big\-endian byte order.
+これらの関数は、整数値のバイトエンコーディングを、
+使用中の CPU ("ホスト") のバイトオーダーから
+リトルエンディアンやビッグエンディアンバイトオーダーへの変換や
+その逆の変換を行う。
-The number, \fInn\fP, in the name of each function indicates the size of
-integer handled by the function, either 16, 32, or 64 bits.
+各関数の名前に付いている数字 \fInn\fP は、その関数が扱う整数のサイズ
+(16, 32, 64 ビットのどれか) を示している。
-The functions with names of the form "htobe\fInn\fP" convert from host byte
-order to big\-endian order.
+名前が "htobe\fInn\fP" という形の関数は、ホストバイトオーダーから
+ビッグエンディアンバイトオーダーへの変換を行う。
-The functions with names of the form "htole\fInn\fP" convert from host byte
-order to little\-endian order.
+名前が "htole\fInn\fP" という形の関数は、ホストバイトオーダーから
+リトルエンディアンバイトオーダーへの変換を行う。
-The functions with names of the form "be\fInn\fPtoh" convert from big\-endian
-order to host byte order.
+名前が "be\fInn\fPtoh" という形の関数は、ビッグエンディアンバイトオーダー
+からホストバイトオーダーへの変換を行う。
-The functions with names of the form "le\fInn\fPtoh" convert from little\-endian
-order to host byte order.
+名前が "le\fInn\fPtoh" という形の関数は、リトルエンディアンバイトオーダー
+からホストバイトオーダーへの変換を行う。
.SH バージョン
-These function were added to glibc in version 2.9.
+これらの関数は glibc バージョン 2.9 で追加された。
.SH 準拠
-These functions are nonstandard. Similar functions are present on the BSDs,
-where the required header file is \fI<sys/endian.h>\fP instead of
-\fI<endian.h>\fP. Unfortunately, NetBSD, FreeBSD, and glibc haven't
-followed the original OpenBSD naming convention for these functions, whereby
-the \fInn\fP component always appears at the end of the function name (thus,
-for example, in NetBSD, FreeBSD, and glibc, the equivalent of OpenBSDs
-"betoh32" is "be32toh").
+これらの関数は非標準である。
+BSD には同様の関数が存在するが、 BSD では
+必要なヘッダファイルは \fI<endian.h>\fP ではなく
+\fI<sys/endian.h>\fP である。
+不幸なことに、 NetBSD, FreeBSD, glibc では、
+これらの関数の元々の OpenBSD での、 \fInn\fP は常に関数名の末尾に置く
+という名前付けルールが踏襲されていない
+(そのため、例を挙げると、 OpenBSD の "betoh32" と等価な関数は
+NetBSD, FreeBSD, glibc では "be32toh" となる)。
.SH 注意
-These functions are similar to the older \fBbyteorder\fP(3) family of
-functions. For example, \fBbe32toh\fP() is identical to \fBntohl\fP()\fB.\fP
+これらの関数は、前からある \fBbyteorder\fP(3) 系の関数と同じである。
+例えば、 \fBbe32toh\fP() は \fBntohl\fP() と等価である。
-The advantage of the \fBbyteorder\fP(3) functions is that they are standard
-functions available on all UNIX systems. On the other hand, the fact that
-they were designed for use in the context of TCP/IP means that they lack the
-64\-bit and little\-endian variants described in this page.
+\fBbyteorder\fP(3) 系の関数のメリットは、これらが
+全ての UNIX システムで利用可能な標準関数である点である。
+一方で、これらの関数は TCP/IP 処理で使用されることを想定して
+設計されたため、このページで説明している 64 ビット版や
+リトルエンディアン版などが存在しない。
.SH 例
-The program below display the results of converting an integer from host
-byte order to both little\-endian and big\-endian byte order. Since host byte
-order is either little\-endian or big\-endian, only one of these conversions
-will have an effect. When we run this program on a little\-endian system
-such as x86\-32, we see the following:
+以下のプログラムは、整数をホストバイトオーダーからリトルエンディアンと
+ビットエンディアンの両方のバイトオーダーに変換し、その結果を表示する。
+ホストバイトオーダーはリトルエンディアンかビットエンディアンのいずれか
+なので、変換に意味があるのはどちらか一方だけである。
+このプログラムを x86\-32 などのリトルエンディアンのシステムで実行した
+場合の実行結果は下記のようになる。
.in +4n
.nf
.SH 関連項目
\fBbyteorder\fP(3)
.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.40 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。