summaryrefslogtreecommitdiffstats
path: root/share/man/man9/byteorder.9
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-03 08:58:04 +0000
committerphk <phk@FreeBSD.org>2003-04-03 08:58:04 +0000
commit50ba1a096a67828c127b6a6a679b40f3bc7267f8 (patch)
tree3c58b25e2dee1f0937c6cbca9ace8dc5167c1cdf /share/man/man9/byteorder.9
parenta7c38434d26b2ac4e10d8be611cde12089261fe8 (diff)
downloadFreeBSD-src-50ba1a096a67828c127b6a6a679b40f3bc7267f8.zip
FreeBSD-src-50ba1a096a67828c127b6a6a679b40f3bc7267f8.tar.gz
Add inline functions {be,le}{16,32,64}{enc,dec}() for encoding decoding
into byte strings of unknown alignment.
Diffstat (limited to 'share/man/man9/byteorder.9')
-rw-r--r--share/man/man9/byteorder.940
1 files changed, 39 insertions, 1 deletions
diff --git a/share/man/man9/byteorder.9 b/share/man/man9/byteorder.9
index 90dac16..6ef719f 100644
--- a/share/man/man9/byteorder.9
+++ b/share/man/man9/byteorder.9
@@ -41,6 +41,9 @@
.Nm le32toh ,
.Nm le64toh
.Nd convert values between big endian, little endian, and host byte order
+.Pp
+.Nm {be,le}{16,32,64}{enc,dec}
+.Nd encode and decode big or little endian values to and from byte strings
.Sh SYNOPSIS
.In sys/endian.h
.Ft uint16_t
@@ -73,6 +76,30 @@
.Fn le32toh "uint32_t little32"
.Ft uint64_t
.Fn le64toh "uint64_t little64"
+.Ft uint16_t
+.Fn be16dec "const void *"
+.Ft uint32_t
+.Fn be32dec "const void *"
+.Ft uint64_t
+.Fn be64dec "const void *"
+.Ft uint16_t
+.Fn le16dec "const void *"
+.Ft uint32_t
+.Fn le32dec "const void *"
+.Ft uint64_t
+.Fn le64dec "const void *"
+.Ft void
+.Fn be16enc "void *, uint16_t"
+.Ft void
+.Fn be32enc "void *, uint32_t"
+.Ft void
+.Fn be64enc "void *, uint64_t"
+.Ft void
+.Fn le16enc "void *, uint16_t"
+.Ft void
+.Fn le32enc "void *, uint32_t"
+.Ft void
+.Fn le64enc "void *, uint64_t"
.Sh DESCRIPTION
The
.Fn bswap16 ,
@@ -118,11 +145,22 @@ and
functions return a integer in the system's native
byte order converted to little endian byte order.
The return value will be the same as the argument on little endian systems.
+.Pp
+The
+.Fn {be,le}{16,32,64}{enc,dec}
+functions encode and decode integers to/from byte strings on any alignment
+in big/little endian format.
.Sh SEE ALSO
.Xr byteorder 3
.Sh HISTORY
-These functions first appeared in
+The hto* and toh* functions first appeared in
.Fx 5.0 ,
and were originally developed by the
.Nx
project.
+.Pp
+The
+.Fn {be,le}{16,32,64}{enc,dec}
+Functions first appeared in
+.Fx 5.1 .
+
OpenPOWER on IntegriCloud