<HTML>
<A NAME="pagetop"></A>
<HEAD>
<TITLE>
Byte Order
</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<H2>
<CENTER>
<A HREF="../index.htm" target="_top"><IMAGE SRC="../image/mokuji.gif"></A>
</CENTER><P>
<CENTER>
<A NAME="byteorder">Byte Order</A>
</CENTER>
</H2>
<HR SIZE="1">
<FONT SIZE="4">
All data is memorized in the computer. The way to be memorized by the
byte unit is called <STRONG>byte order</STRONG>.
It depends on the type of the computer (strictly speaking, CPU).
<P>
There are two types of byte orders as follows:
<OL>
<LI><STRONG><A NAME="bigendian">Big Endian</A></STRONG>
 - Data is stored in the order from the highest to the lowest as follows.
<BR>
<CENTER>
<BR>
<TABLE BORDER="2" ALIGN="center">
<CAPTION ALIGN="bottom">integer 4 bytes data 12345678</CAPTION>
<TR>
<TH>highest</TH><TH></TH><TH></TH><TH>lowest</TH>
</TR>
<TR>
<TD WIDTH="100" ALIGN="center">12</TD>
<TD WIDTH="100" ALIGN="center">34</TD>
<TD WIDTH="100" ALIGN="center">56</TD>
<TD WIDTH="100" ALIGN="center">78</TD>
</TR>
</CENTER>
</TABLE>
<BR>
Data is stored in this way in SUN, HP, SGI and IBM Workstations.
<P>
<BR>
<LI><STRONG><A NAME="littleendian">Little Endian</A></STRONG>
 - Data is stored in the order from the lowest to the highest as follows.
<BR>
<CENTER>
<BR>
<TABLE BORDER="2" ALIGN="center">
<CAPTION ALIGN="bottom">integer 4 bytes data 12345678</CAPTION>
<TR>
<TH>highest</TH><TH></TH><TH></TH><TH>lowest</TH>
</TR>
<TR>
<TD WIDTH="100" ALIGN="center">78</TD>
<TD WIDTH="100" ALIGN="center">56</TD>
<TD WIDTH="100" ALIGN="center">34</TD>
<TD WIDTH="100" ALIGN="center">12</TD>
</TR>
</CENTER>
</TABLE>
<BR>
Data is stored in 80X86 type computers which are major in PC's.
</OL>
<P>
You do not have to consider this difference when you use the same
types of computers, but you have to take care of it when you use
both two types of computers above.
<BR>
When you use ASCII data, no problem occurs. 
<FONT COLOR="red">
But you have to consider byte order when you use binary data.
</FONT>
</FONT>
<HR SIZE="1">
<H2>
<CENTER>
<A NAME="swap">Swap Bytes</A>
</CENTER>
</H2>
<HR SIZE="1">
<FONT SIZE="4">
MicroAVS adopts XDR(External Data Representation) format 
(<A HREF="#bigendian">Big Endian</A> in fact) which is 
standardized by IEEE in the reading of binary data.
<P>
Unfortunately <A HREF="#byteorder">byte order</A> of data cannot
be judged automatically by only reading the data.
But if <A HREF="#byteorder">byte order</A> is known, 
it can be converted.
<P>
Because byte swap parameter of MicroAVS is XDR 
(<A HREF="#bigendian">Big Endian</A>) as default, 
MicroAVS tries to read as XDR format. 
If you turn XDR toggle off, it tries to read as native byte order.
If you turn byte swap toggle on, it tries to read swapping byte order.
</FONT>
<HR SIZE="1">
<TABLE BORDER=0 WIDTH="100%"><TR><TD ALIGN=LEFT>
<A HREF="#pagetop"><IMG SRC="../image/pagetop.gif" ALT="UP"></A></TD><BR>
<TD ALIGN=RIGHT><FONT FACE="MS SANS SERIF" SIZE=1 COLOR="BLACK">
&copy; 1999-2011 <A HREF="http://www.cybernet.co.jp/english/">CYBERNET SYSTEMS CO.,LTD.</A>
 All rights reserved.</FONT></TD>
</TR></TABLE>
</BODY>
</HTML>