summaryrefslogtreecommitdiff
path: root/endianess_8h_source.html
blob: e70666b10a1e4d6d17566f37b78e8c976408edec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>navit: endianess.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">navit
   &#160;<span id="projectnumber">0.5.3-trunk</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('endianess_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">endianess.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="endianess_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#ifndef __ENDIANESS_HANDLER__</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;  <span class="comment">/* The following is based on xorg/xserver/GL/glx/glxbyteorder.h</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">   * which is (c) IBM Corp. 2006,2007 and originally licensed under the following</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">   * BSD-license. All modifications in navit are licensed under the GNU GPL as</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">   * described in file &quot;COPYRIGHT&quot;.</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">   *</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">   * Portions also from GNU C Library include/bits/byteswap.h Also licsend</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">   * under the GPL.</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">   *</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">   * --------------------------</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">   * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">   * copy of this software and associated documentation files (the &quot;Software&quot;),</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">   * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="comment">   * the rights to use, copy, modify, merge, publish, distribute, sub license,</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment">   * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">   * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="comment">   *</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment">   * The above copyright notice and this permission notice (including the next</span></div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment">   * paragraph) shall be included in all copies or substantial portions of the</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">   * Software.</span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">   *</span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">   * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">   * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment">   * THE COPYRIGHT HOLDERS, THE AUTHORS, AND/OR THEIR SUPPLIERS BE LIABLE FOR</span></div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment">   * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</span></div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">   * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment">   * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">   */</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">#if HAVE_BYTESWAP_H</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;  <span class="comment">/* machine dependent versions of byte swapping functions.  GNU extension.*/</span></div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">  #include &lt;byteswap.h&gt;</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">#if HAVE_ENDIAN_H</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor">  #include &lt;endian.h&gt;</span></div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="preprocessor">#elif defined(USE_SYS_ENDIAN_H)</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="preprocessor">  #include &lt;sys/endian.h&gt;</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="preprocessor">#if defined(_BYTE_ORDER) &amp;&amp; !defined(__BYTE_ORDER)</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="preprocessor">#define __BYTE_ORDER _BYTE_ORDER</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="preprocessor">#define __LITTLE_ENDIAN _LITTLE_ENDIAN</span></div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="preprocessor">#define __BIG_ENDIAN _BIG_ENDIAN</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#elif defined(__APPLE__)</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">  #include &lt;libkern/OSByteOrder.h&gt;</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">  #define __bswap_16 OSSwapInt16</span></div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">  #define __bswap_32 OSSwapInt32</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="preprocessor">  #define __bswap_64 OSSwapInt64</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">#ifndef __BYTE_ORDER</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">  #define __LITTLE_ENDIAN 1234</span></div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="preprocessor">  #define __BIG_ENDIAN 4321</span></div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="preprocessor">  #if defined(__LITTLE_ENDIAN__)</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">    #define __BYTE_ORDER __LITTLE_ENDIAN</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="preprocessor">  #elif defined(__BIG_ENDIAN__)</span></div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="preprocessor">    #define __BYTE_ORDER __BIG_ENDIAN</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="preprocessor">  #else</span></div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="preprocessor">    #error &quot;No endianness defined for Mac OS!&quot;</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="preprocessor">  #endif</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="preprocessor">#elif  defined(_WIN32) || defined(__CEGCC__)</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">  #define __BIG_ENDIAN 4321</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="preprocessor">  #define __LITTLE_ENDIAN 1234</span></div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">  #define __BYTE_ORDER __LITTLE_ENDIAN</span></div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="endianess_8h.html#a8cccb4a214faded757990fdbc99a0cd3">   86</a></span>&#160;<span class="preprocessor">  #define __bswap_16(__bsx) ((((__bsx) &gt;&gt; 8) &amp; 0xff) | (((__bsx) &amp; 0xff) &lt;&lt; 8))</span></div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="endianess_8h.html#a130b07d1d1fcbc63e83b346dd74397d5">   87</a></span>&#160;<span class="preprocessor">  #define __bswap_32(__bsx) ((((__bsx) &amp; 0xff000000) &gt;&gt; 24) | \</span></div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="preprocessor">                             (((__bsx) &amp; 0x00ff0000) &gt;&gt;  8) |\</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="preprocessor">                             (((__bsx) &amp; 0x0000ff00) &lt;&lt;  8) | \</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="preprocessor">                             (((__bsx) &amp; 0x000000ff) &lt;&lt; 24))</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="preprocessor">#if  __BYTE_ORDER == __BIG_ENDIAN</span></div><div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="endianess_8h.html#a65e9510f535c1ee2f826d447471289fa">   96</a></span>&#160;<span class="preprocessor">  #define le16_to_cpu(x)        __bswap_16 (x)</span></div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="endianess_8h.html#a48f527b00bc1d5e46366d720280a1039">   97</a></span>&#160;<span class="preprocessor">  #define le32_to_cpu(x)        __bswap_32 (x)</span></div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="endianess_8h.html#a0987d88a4fac98f0b1d6355ef7aa77e2">   98</a></span>&#160;<span class="preprocessor">  #define le64_to_cpu(x)        __bswap_64 (x)</span></div><div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="endianess_8h.html#aeda3065f344779edb9023e22d84d5f92">   99</a></span>&#160;<span class="preprocessor">  #define cpu_to_le16(x)        __bswap_16 (x)</span></div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="endianess_8h.html#a1d5ae0c36d519a1b0a789db69a598f28">  100</a></span>&#160;<span class="preprocessor">  #define cpu_to_le32(x)        __bswap_32 (x)</span></div><div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="endianess_8h.html#aa170dc4b2dae5b00bdec3a307427240f">  101</a></span>&#160;<span class="preprocessor">  #define cpu_to_le64(x)        __bswap_64 (x)</span></div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="preprocessor">#elif __BYTE_ORDER == __LITTLE_ENDIAN</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="preprocessor">  #define le16_to_cpu(x)        (x)</span></div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="preprocessor">  #define le32_to_cpu(x)        (x)</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="preprocessor">  #define cpu_to_le16(x)        (x)</span></div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">  #define cpu_to_le32(x)        (x)</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="preprocessor">#else</span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">  #error &quot;Unknown endianess&quot;</span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="endianess_8h.html#ac902be04badd9a68d9ebbce6be15a576">  111</a></span>&#160;<span class="preprocessor">#define __ENDIANESS_HANDLER__</span></div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div></div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="endianess_8h.html">endianess.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>