blob: 5eefd9d6a82373164cb60f5697c68678e0f17f7b [file] [log] [blame]
<head>
<title>mach-swap(3) - Plan 9 from User Space</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</head>
<body bgcolor=#ffffff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=10><td>
<tr><td width=20><td>
<tr><td width=20><td><b>MACH-SWAP(3)</b><td align=right><b>MACH-SWAP(3)</b>
<tr><td width=20><td colspan=2>
<br>
<p><font size=+1><b>NAME </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
beswap2, beswap4, beswap8, beieeeftoa32, beieeeftoa64, beieeeftoa80,
beload2, beload4, beload8, leswap2, leswap4, leswap8, leieeeftoa32,
leieeeftoa64, leieeeftoa80, leload2, leload4, leload8, ieeeftoa32,
ieeeftoa64 &ndash; machine-independent access to byte-ordered data<br>
</table>
<p><font size=+1><b>SYNOPSIS </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>#include &lt;u.h&gt;<br>
#include &lt;libc.h&gt;<br>
#include &lt;mach.h&gt;
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
</font></tt>
<tt><font size=+1>u16int beswap2(u16int u)<br>
</font></tt>u32int &nbsp;&nbsp;&nbsp;beswap4(u32int u)<br>
u64int &nbsp;&nbsp;&nbsp;beswap8(u64int u)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;beieeeftoa32(char *a, uint n, void *f)<br>
</font></tt>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beieeeftoa64(char *a, uint n, void *f)<br>
int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beieeeftoa80(char *a, uint n, void *f)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>u16int beload2(uchar *p)<br>
</font></tt>u32int &nbsp;&nbsp;&nbsp;beload4(uchar *p)<br>
u64int &nbsp;&nbsp;&nbsp;beload8(uchar *p)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>u16int leswap2(u16int u)<br>
</font></tt>u32int &nbsp;&nbsp;&nbsp;leswap4(u32int u)<br>
u64int &nbsp;&nbsp;&nbsp;leswap8(u64int u)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;leieeeftoa32(char *a, uint n, void *f)<br>
</font></tt>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leieeeftoa64(char *a, uint n, void *f)<br>
int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leieeeftoa80(char *a, uint n, void *f)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>u16int leload2(uchar *p)<br>
</font></tt>u32int &nbsp;&nbsp;&nbsp;leload4(uchar *p)<br>
u64int &nbsp;&nbsp;&nbsp;leload8(uchar *p)
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<tt><font size=+1>int &nbsp;&nbsp;&nbsp;&nbsp;ieeeftoa32(char *a, uint n, u32int u)<br>
</font></tt>int &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ieeeftoa64(char *a, uint n, u32int hi, u32int lo)<br>
</table>
<p><font size=+1><b>DESCRIPTION </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
These functions provide machine-independent access to data in
a particular byte order.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Beswap2</i>, <i>beswap4</i>, and <i>beswap8</i> return the 2-byte, 4-byte, and 8-byte
big-endian representation of the bytes in <i>val</i>, respectively.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Beload2</i>, <i>beload4</i>, and <i>beload8</i> return the 2-byte, 4-byte, and 8-byte
big-endian interpretation of the bytes at <i>p</i>, respectively.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Beieeeftoa32</i>, <i>beieeeftoa64</i>, and <i>beieeeftoa80</i> format the big-endian
4-byte, 8-byte, or 10-byte IEEE floating-point value at <i>f</i> into
the <i>n</i>-byte string buffer <i>a</i>.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Leswap2</i>, <i>leswap4</i>, etc. are the little-endian equivalents of the
routines just described.
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
<i>Ieeeftoa32</i> and <i>ieeeftoa64</i> format a local machine byte-order floating-point
value into the <i>n</i>-byte string buffer <i>a</i>. <i>Ieeeftoa32</i> expects a 32-bit
floating-point value stored in the bits of <i>u</i>. <i>Ieeeftoa64</i> expects
a 64-bit floating-point value whose high 32-bits are in <i>hi</i> and
low 32-bits are in <i>lo</i>.
</table>
<p><font size=+1><b>SOURCE </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<tt><font size=+1>/usr/local/plan9/src/libmach<br>
</font></tt>
</table>
<p><font size=+1><b>SEE ALSO </b></font><br>
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
<a href="../man3/mach.html"><i>mach</i>(3)</a><br>
</table>
<td width=20>
<tr height=20><td>
</table>
<!-- TRAILER -->
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr height=15><td width=10><td><td width=10>
<tr><td><td>
<center>
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
</center>
</table>
<!-- TRAILER -->
</body></html>