1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>MI_SwapEndian*</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">MI_SwapEndian* <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1>
15<h2>Syntax</h2>
16
17<dl>
18  <dd>
19  <pre><CODE>
20#include &lt;nitro/mi.h&gt;
21
22#define MI_SwapEndian8(val)  (u8)(val)
23#define MI_SwapEndian16(val) (u16)((((val) &amp; 0xFF00UL) &gt;&gt; 8UL) | (((val) &amp; 0x00FFUL) &lt;&lt; 8UL))
24#define MI_SwapEndian32(val) (u32)(                                 \
25                                (((val) &amp; 0xFF000000UL) &gt;&gt; 24UL) |  \
26                                (((val) &amp; 0x00FF0000UL) &gt;&gt;  8UL) |  \
27                                (((val) &amp; 0x0000FF00UL) &lt;&lt;  8UL) |  \
28                                (((val) &amp; 0x000000FFUL) &lt;&lt; 24UL) )
29#define MI_SwapEndian64(val) (u64)(                                         \
30                              (((val) &amp; 0xFF00000000000000ULL) &gt;&gt; 56ULL)    \
31                            | (((val) &amp; 0x00FF000000000000ULL) &gt;&gt; 40ULL)    \
32                            | (((val) &amp; 0x0000FF0000000000ULL) &gt;&gt; 24ULL)    \
33                            | (((val) &amp; 0x000000FF00000000ULL) &gt;&gt;  8ULL)    \
34                            | (((val) &amp; 0x00000000FF000000ULL) &lt;&lt;  8ULL)    \
35                            | (((val) &amp; 0x0000000000FF0000ULL) &lt;&lt; 24ULL)    \
36                            | (((val) &amp; 0x000000000000FF00ULL) &lt;&lt; 40ULL)    \
37                            | (((val) &amp; 0x00000000000000FFULL) &lt;&lt; 56ULL) )
38</CODE></pre>
39  <br>
40  </dd>
41</dl>
42<h2>Arguments</h2>
43<TABLE border="1" width="100%">
44  <TBODY>
45    <TR>
46<TD width="13%"><EM><STRONG>val</STRONG></EM></TD>
47<TD width="87%">The value whose endianity is to be converted.<BR><B>Note:</B> Because this is a macro, evaluation is performed several times.</TD>
48    </TR>
49  </TBODY>
50</TABLE>
51
52<h2>Return Values</h2>
53<p>Value for which endianness was converted (<CODE>u16, u32, u64</CODE>).</p>
54
55<H2>Description</H2>
56<P>Converts the endian of the specified (16-, 32-, or 64-bit) value. If little endian is detected before conversion, big endian results after conversion.<br><B>Note: </B>Because this is a macro, arguments are evaluated several times.</P>
57<p>These 8-bit versions do not actually perform any conversions, but they have been included for uniform source code visibility.</p>
58<H2>See Also</H2>
59<P><CODE><A href="MI_Load.html">MI_Load*</A><BR> <A href="MI_Store.html">MI_Store*</A><BR> <A href="MI_HTo.html">MI_HTo*</A><BR> <A href="MI_ToH.html">MI_*ToH*</A></CODE></P>
60<H2>Revision History</H2>
61<P>
622007/11/21 Added a description of the 64-bit version.<br> 2006/06/13 Added a description of the 8-bit version.<br> 2006/04/05 Initial version.<br>
63</P>
64<hr><p>CONFIDENTIAL</p></body>
65</html>
66