| <a href="fixed__point_8h.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * Copyright (c) 2017-2018 ARM Limited.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> *</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a copy</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * of this software and associated documentation files (the "Software"), to</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * deal in the Software without restriction, including without limitation the</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * sell copies of the Software, and to permit persons to whom the Software is</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> * furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> *</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * The above copyright notice and this permission notice shall be included in all</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * copies or substantial portions of the Software.</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> *</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * SOFTWARE.</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="comment"> */</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#ifndef ARM_COMPUTE_FIXED_POINT_H</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#define ARM_COMPUTE_FIXED_POINT_H</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae1ac323de0ecd37f54553c25092d2ba4"> 27</a></span> <span class="preprocessor">#define TYPE_ALIAS(type, alias) \</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor"> typedef type alias; \</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor"> typedef type alias##x##1; \</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span> <span class="preprocessor"> typedef type##2 alias##x##2; \</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="preprocessor"> typedef type##3 alias##x##3; \</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="preprocessor"> typedef type##4 alias##x##4; \</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> <span class="preprocessor"> typedef type##8 alias##x##8; \</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="preprocessor"> typedef type##16 alias##x##16;</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a"> 36</a></span> <a class="code" href="fixed__point_8h.xhtml#ae1ac323de0ecd37f54553c25092d2ba4">TYPE_ALIAS</a>(<span class="keywordtype">char</span>, <a class="code" href="fixed__point_8h.xhtml#a96d48f67de90aaed492da7fb7a006b94">qs8</a>)</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a"> 37</a></span> <a class="code" href="fixed__point_8h.xhtml#ae1ac323de0ecd37f54553c25092d2ba4">TYPE_ALIAS</a>(<span class="keywordtype">short</span>, <a class="code" href="fixed__point_8h.xhtml#a26a8ca855cd14b1867173d301baf6c4f">qs16</a>)</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5"> 38</a></span> <a class="code" href="fixed__point_8h.xhtml#ae1ac323de0ecd37f54553c25092d2ba4">TYPE_ALIAS</a>(<span class="keywordtype">int</span>, <a class="code" href="fixed__point_8h.xhtml#a8115de4a1860a9bf15e13f4ebfdb707f">qs32</a>)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a10ab0002d59a950b7e7100f431832174"> 40</a></span> <span class="preprocessor">#define qs8_MIN ((char)CHAR_MIN)</span></div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac0a5138b20a5fc54e092b8335213b3db"> 41</a></span> <span class="preprocessor">#define qs8_MAX ((char)CHAR_MAX)</span></div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8f3a79453a6d9f3cb4e4c1e15647c2f8"> 42</a></span> <span class="preprocessor">#define qs16_MIN ((short)SHRT_MIN)</span></div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a3668744b91058e80feae452f3fff6ecd"> 43</a></span> <span class="preprocessor">#define qs16_MAX ((short)SHRT_MAX)</span></div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a65c09b33d7e8ec44c112123516395303"> 44</a></span> <span class="preprocessor">#define qs32_MIN ((int)INT_MIN)</span></div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a665d827df7100fdcb1debb9ebfda2081"> 45</a></span> <span class="preprocessor">#define qs32_MAX ((int)INT_MAX)</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a87c333c4d447a56aaa1794163bffb934"> 47</a></span> <span class="preprocessor">#define qu8_MIN ((uchar)0)</span></div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae3e8582121053f90052a5d6b493b893a"> 48</a></span> <span class="preprocessor">#define qu8_MAX ((uchar)UCHAR_MAX)</span></div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#addb83fbb729412b4d63acf37d11a4dfe"> 49</a></span> <span class="preprocessor">#define qu16_MIN ((ushort)0)</span></div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae26774fb9d07b6c3965b1af0fe51d14d"> 50</a></span> <span class="preprocessor">#define qu16_MAX ((ushort)USHRT_MAX)</span></div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4b5f7492fbe94585b4d6ba2b7481261a"> 51</a></span> <span class="preprocessor">#define qu32_MIN ((uint)0)</span></div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9b24ec1f75f64ba7317d874e79f20165"> 52</a></span> <span class="preprocessor">#define qu32_MAX ((uint)UINT_MAX)</span></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a79ca4f195e178410c0e034216e90f811"> 54</a></span> <span class="preprocessor">#define qs8_TYPE char</span></div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad77b91071787b84a9cd514cf5c526fdb"> 55</a></span> <span class="preprocessor">#define qs8x1_TYPE char</span></div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a15ba5721b7d6b798965f1fe03609f657"> 56</a></span> <span class="preprocessor">#define qs8x2_TYPE char2</span></div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7bd1921b9cbbf8b03867899a43db99d3"> 57</a></span> <span class="preprocessor">#define qs8x3_TYPE char3</span></div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a33854718153786d2995ff57a77966fa0"> 58</a></span> <span class="preprocessor">#define qs8x4_TYPE char4</span></div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a21f99c110a4e266a7c48ffc62f91bb6d"> 59</a></span> <span class="preprocessor">#define qs8x8_TYPE char8</span></div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae9cb49b1f87d857347bcf0add8217bff"> 60</a></span> <span class="preprocessor">#define qs8x16_TYPE char16</span></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> </div><div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a995fa4e2cf5895940e629f49c87a9e66"> 62</a></span> <span class="preprocessor">#define qs16_TYPE short</span></div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae5f0a20c461cd5421516da8559e30bc9"> 63</a></span> <span class="preprocessor">#define qs16x1_TYPE short</span></div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa3594535118e4158134b8de127757e70"> 64</a></span> <span class="preprocessor">#define qs16x2_TYPE short2</span></div><div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4d43a0b433fada2a4c21bdc6d66f8e1f"> 65</a></span> <span class="preprocessor">#define qs16x3_TYPE short3</span></div><div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aba2fe52f3ee4677740c679607cdcb5f1"> 66</a></span> <span class="preprocessor">#define qs16x4_TYPE short4</span></div><div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad11e2aa7cd3de96b0be10b9273de99bb"> 67</a></span> <span class="preprocessor">#define qs16x8_TYPE short8</span></div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a66d3b76441cc5c126ea3c2eacd66755c"> 68</a></span> <span class="preprocessor">#define qs16x16_TYPE short16</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4dc3c9f8c9fe5f18308eb6a0b31668b6"> 70</a></span> <span class="preprocessor">#define qs32_TYPE int</span></div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a0a7583559301a450cfd243030c03bcc3"> 71</a></span> <span class="preprocessor">#define qs32x1_TYPE int</span></div><div class="line"><a name="l00072"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae5e7b593b19e045c09d2f0097398dfa0"> 72</a></span> <span class="preprocessor">#define qs32x2_TYPE int2</span></div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6c20f71e5c89970ee4f1659666e3cd8f"> 73</a></span> <span class="preprocessor">#define qs32x3_TYPE int3</span></div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa912b7f2743520fec942e0a4c7acf1f5"> 74</a></span> <span class="preprocessor">#define qs32x4_TYPE int4</span></div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1e11b506599174c9fd83688cf116ab7e"> 75</a></span> <span class="preprocessor">#define qs32x8_TYPE int8</span></div><div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#adbd8b659ba077c1cceb5d560db65d4b9"> 76</a></span> <span class="preprocessor">#define qs32x16_TYPE int16</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span> </div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment">/* All internal constants are represented in the maximum supported fixed point format (QS16),</span></div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="comment"> * thus we define an additional shift parameter required to convert the constant</span></div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"> * from the maximum supported format to the require one.</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> <span class="comment"> */</span></div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a46e1f404fdd6e80eec6e0f50e5f0383c"> 82</a></span> <span class="preprocessor">#define qs8_SHIFT 8</span></div><div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a36ef9fc1f840658270248d8e53fd8140"> 83</a></span> <span class="preprocessor">#define qs16_SHIFT 0</span></div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> </div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> <span class="preprocessor">#undef VEC_DATA_TYPE_STR</span></div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> <span class="preprocessor">#undef VEC_DATA_TYPE</span></div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span> <span class="preprocessor">#undef CONVERT_STR</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span> <span class="preprocessor">#undef CONVERT</span></div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> <span class="preprocessor">#undef CONVERT_SAT_STR</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="preprocessor">#undef CONVERT_SAT</span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae802822defb0fa3a7f74f98e324696cb"> 92</a></span> <span class="preprocessor">#define VEC_DATA_TYPE_STR(type, size) type##x##size</span></div><div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a36f754c05b6fddf6df0d8d0a74f8159f"> 93</a></span> <span class="preprocessor">#define VEC_DATA_TYPE(type, size) VEC_DATA_TYPE_STR(type, size)</span></div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span> </div><div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a37089d60b5f5a76176fdb94835a98ff4"> 95</a></span> <span class="preprocessor">#define CONVERT_STR3(x, type, rtype) (convert_##rtype((x)))</span></div><div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a424c5edfa264fb94d0eb44d59d103e29"> 96</a></span> <span class="preprocessor">#define CONVERT_STR2(x, type, rtype) CONVERT_STR3(x, type, rtype)</span></div><div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4090567b3adb034c7cc1af308cb45670"> 97</a></span> <span class="preprocessor">#define CONVERT_STR(x, type) CONVERT_STR2(x, type, type##_TYPE)</span></div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa8d95ba04fc73845abc6045952cae5be"> 98</a></span> <span class="preprocessor">#define CONVERT(x, type) CONVERT_STR(x, type)</span></div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span> </div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae5bd7ebff4bb9df1b26f2b71b31e928a"> 100</a></span> <span class="preprocessor">#define CONVERT_SAT_STR3(x, type, rtype) (convert_##rtype##_sat((x)))</span></div><div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8aa11a06d0685e1cc6dfac964f9c3cee"> 101</a></span> <span class="preprocessor">#define CONVERT_SAT_STR2(x, type, rtype) CONVERT_SAT_STR3(x, type, rtype)</span></div><div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4e0fc93c9a69863dcdf7672ab547026c"> 102</a></span> <span class="preprocessor">#define CONVERT_SAT_STR(x, type) CONVERT_SAT_STR2(x, type, type##_TYPE)</span></div><div class="line"><a name="l00103"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a23fb01b6f3453cc0e48a026fd44f6acd"> 103</a></span> <span class="preprocessor">#define CONVERT_SAT(x, type) CONVERT_SAT_STR(x, type)</span></div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1acc7badafd7def20af187c5b5bfdec2"> 111</a></span> <span class="preprocessor">#define ABSQ_SAT_IMPL(type) \</span></div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> <span class="preprocessor"> inline type abs_##type##_sat(type VopA) \</span></div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="preprocessor"> return CONVERT_SAT(abs(VopA), type); \</span></div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span> </div><div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4548a232dd77f023b53557a12a3a98b2"> 117</a></span> <a class="code" href="fixed__point_8h.xhtml#a1acc7badafd7def20af187c5b5bfdec2">ABSQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5a2cc1a836612185f0378de9e7159e27">qs8x16</a>)</div><div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a08e6c4717be6784a6df7c43bfcc8655d"> 118</a></span> <a class="code" href="fixed__point_8h.xhtml#a1acc7badafd7def20af187c5b5bfdec2">ABSQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>)</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span> </div><div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a096a0b33d9bf00fd65287a1ceafa227c"> 120</a></span> <span class="preprocessor">#define ABS_SAT_OP_EXPAND_STR(a, type, size) abs_##type##x##size##_sat((a))</span></div><div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a66d987917da70dfc88bee76cda323e0a"> 121</a></span> <span class="preprocessor">#define ABS_SAT_OP_EXPAND(a, type, size) ABS_SAT_OP_EXPAND_STR(a, type, size)</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86"> 129</a></span> <span class="preprocessor">#define MAXQ_IMPL(type) \</span></div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="preprocessor"> inline type max_##type(type VopA, type VopB) \</span></div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="preprocessor"> return max(VopA, VopB); \</span></div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span> </div><div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6cf8baa93541eee58c1575859344d858"> 135</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a230d9b32261264756a0d3d4971964753">qs8x1</a>)</div><div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9b9740928192b24b99e30233458b106f"> 136</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3ab174b05a269317ec18680b5c781a04">qs8x2</a>)</div><div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a0b8cb75deddaf8856fb53d1178a35d7f"> 137</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a10dfbf9412b518cd160133b68e2da8fd">qs8x4</a>)</div><div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#af93c5c0b7d3a8183645521ca0fb10b0e"> 138</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a">qs8x8</a>)</div><div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a2635ed6914ae75900d7bf215356a44e4"> 139</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5a2cc1a836612185f0378de9e7159e27">qs8x16</a>)</div><div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a3d1133437c9316867a68fabaeeb1c349"> 140</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#aab72e548e91d1bac44d0a8503dfa12e7">qs16x1</a>)</div><div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ab64c4eaecfd5b3adaefeea3e74b20efc"> 141</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ac120446f465238102c2ba0a23ae4aa47">qs16x2</a>)</div><div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#acf7b70bd039a92c0b8e6bae61a46c514"> 142</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5e34d3e41af677765369d33a3871d95f">qs16x4</a>)</div><div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a68d082072cbdb8b617e0246d277a2a8f"> 143</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>)</div><div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aaa6b333d702243ee48d98f8b6ab04fa8"> 144</a></span> <a class="code" href="fixed__point_8h.xhtml#a21e1c22d1a3f0110ceb0ef48c6dddb86">MAXQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a16a82528f3e1c6eb81fd9aac6ad45e62">qs16x16</a>)</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span> </div><div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a60a130cf40adc457ce483d5912e1459c"> 146</a></span> <span class="preprocessor">#define MAX_OP_EXPAND_STR(a, b, type, size) max_##type##x##size((a), (b))</span></div><div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afeab3b374d78c30712736e16cbb5aa15"> 147</a></span> <span class="preprocessor">#define MAX_OP_EXPAND(a, b, type, size) MAX_OP_EXPAND_STR(a, b, type, size)</span></div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182"> 155</a></span> <span class="preprocessor">#define ADDQ_SAT_IMPL(type) \</span></div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> <span class="preprocessor"> inline type add_sat_##type(type VopA, type VopB) \</span></div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="preprocessor"> return add_sat(VopA, VopB); \</span></div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span> </div><div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a86a238190b4587b960b351efa6ced2e7"> 161</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a230d9b32261264756a0d3d4971964753">qs8x1</a>)</div><div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a98dd18822a91a19b474a8fd15d50061f"> 162</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3ab174b05a269317ec18680b5c781a04">qs8x2</a>)</div><div class="line"><a name="l00163"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a68f46f9e97a25605433c60c1cb094a18"> 163</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a10dfbf9412b518cd160133b68e2da8fd">qs8x4</a>)</div><div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1bdc124e4540215bcb74728079567b57"> 164</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a">qs8x8</a>)</div><div class="line"><a name="l00165"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6faff16a13c9424932e11379a70455d4"> 165</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5a2cc1a836612185f0378de9e7159e27">qs8x16</a>)</div><div class="line"><a name="l00166"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a938b168b2ee376ec12181ddda282dada"> 166</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#aab72e548e91d1bac44d0a8503dfa12e7">qs16x1</a>)</div><div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afe98542620c3f6ea5a29ac05b4c8900b"> 167</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ac120446f465238102c2ba0a23ae4aa47">qs16x2</a>)</div><div class="line"><a name="l00168"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad603ae6114bbce3fa9bd8e8debd6fdea"> 168</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5e34d3e41af677765369d33a3871d95f">qs16x4</a>)</div><div class="line"><a name="l00169"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afda8a27ba1a7360bac98af6e90968a48"> 169</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>)</div><div class="line"><a name="l00170"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afd8142a5de5c45701d8846030ac01ac9"> 170</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a16a82528f3e1c6eb81fd9aac6ad45e62">qs16x16</a>)</div><div class="line"><a name="l00171"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9d8aada55ce6f27ec5cb2a66d6bc9d22"> 171</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a513b425c3ee001dddfdde427947ccf00">qs32x1</a>)</div><div class="line"><a name="l00172"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a878f5ce2b7bd2321138ac5f950a49911"> 172</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#addf730860de5f7752f0c85a385088e96">qs32x2</a>)</div><div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a598bb32725cac3d3bc202230f61800cb"> 173</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3df1d8363c18bb92b3451d41c6bfc891">qs32x4</a>)</div><div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad8f393b0b41cb21689ddade3ff9ef1fa"> 174</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00175"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a060f775d2cfcf5eebe4e95ea7be3a57b"> 175</a></span> <a class="code" href="fixed__point_8h.xhtml#ad2ad548e04bfbba48bf75e29c9699182">ADDQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a7e505a06809f9ab428dd0ba9be1ea35e">qs32x16</a>)</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div><div class="line"><a name="l00177"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8fe4e6aa79b6e2faec019e53e1f39113"> 177</a></span> <span class="preprocessor">#define ADD_SAT_OP_EXPAND_STR(a, b, type, size) add_sat_##type##x##size((a), (b))</span></div><div class="line"><a name="l00178"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6b1acbaff6cb3bad4edda9a93dac1f9e"> 178</a></span> <span class="preprocessor">#define ADD_SAT_OP_EXPAND(a, b, type, size) ADD_SAT_OP_EXPAND_STR(a, b, type, size)</span></div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> </div><div class="line"><a name="l00186"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7"> 186</a></span> <span class="preprocessor">#define SUBQ_SAT_IMPL(type) \</span></div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> <span class="preprocessor"> inline type sub_sat_##type(type VopA, type VopB) \</span></div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> <span class="preprocessor"> return sub_sat(VopA, VopB); \</span></div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> </div><div class="line"><a name="l00192"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a17474ee664876c4e265341f07f6b3562"> 192</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a230d9b32261264756a0d3d4971964753">qs8x1</a>)</div><div class="line"><a name="l00193"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae078571f80bab0d4473b5786220ca557"> 193</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3ab174b05a269317ec18680b5c781a04">qs8x2</a>)</div><div class="line"><a name="l00194"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1acb5de3f800cd2d0068e25d833d8cdc"> 194</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a10dfbf9412b518cd160133b68e2da8fd">qs8x4</a>)</div><div class="line"><a name="l00195"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7635f49daeea0c64e1b153056d7b8b6c"> 195</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a">qs8x8</a>)</div><div class="line"><a name="l00196"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#add35b8b1a8470b2777098251bd3b2230"> 196</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5a2cc1a836612185f0378de9e7159e27">qs8x16</a>)</div><div class="line"><a name="l00197"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4d22f610d17883dae5370c3e7d154c76"> 197</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#aab72e548e91d1bac44d0a8503dfa12e7">qs16x1</a>)</div><div class="line"><a name="l00198"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#af0d4e5500f90ef66bdf87b01bbb8e942"> 198</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ac120446f465238102c2ba0a23ae4aa47">qs16x2</a>)</div><div class="line"><a name="l00199"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac860bf2f067fb42de2c8db799423104f"> 199</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5e34d3e41af677765369d33a3871d95f">qs16x4</a>)</div><div class="line"><a name="l00200"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac409af663422e74467d0fe174592b406"> 200</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>)</div><div class="line"><a name="l00201"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9b91ed896c5093a7b73b15eb2539d804"> 201</a></span> <a class="code" href="fixed__point_8h.xhtml#ab555884d2db3be32fc693f670d8a99c7">SUBQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a16a82528f3e1c6eb81fd9aac6ad45e62">qs16x16</a>)</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span> </div><div class="line"><a name="l00203"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7076a8fac3c484611ce522dc7103fff4"> 203</a></span> <span class="preprocessor">#define SUB_SAT_OP_EXPAND_STR(a, b, type, size) sub_sat_##type##x##size((a), (b))</span></div><div class="line"><a name="l00204"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac081784e1547f3f2e9065e3ed54f2fba"> 204</a></span> <span class="preprocessor">#define SUB_SAT_OP_EXPAND(a, b, type, size) SUB_SAT_OP_EXPAND_STR(a, b, type, size)</span></div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> </div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> <span class="comment">/* Multiply of two fixed point numbers</span></div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> <span class="comment"> *</span></div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> <span class="comment"> * @param[in] type the actual data type.</span></div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span> <span class="comment"> * @param[in] itype the intermediate data type.</span></div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span> <span class="comment"> *</span></div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span> <span class="comment"> * @return The result of the fixed point multiplication.</span></div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span> <span class="comment"> */</span></div><div class="line"><a name="l00213"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8900371ff8da316eea9c61c993043ca5"> 213</a></span> <span class="preprocessor">#define MULQ_IMPL(type, itype) \</span></div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span> <span class="preprocessor"> inline type mul_##type(type VopA, type VopB, int fixed_point_position) \</span></div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> <span class="preprocessor"> itype round_val = (itype)(1 << (fixed_point_position - 1)); \</span></div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span> <span class="preprocessor"> itype res = CONVERT((VopA), itype) * CONVERT((VopB), itype) + round_val; \</span></div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span> <span class="preprocessor"> return CONVERT((res >> (itype)fixed_point_position), type); \</span></div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span> </div><div class="line"><a name="l00221"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9a50c35ce1383cd23d3ab166a7929013"> 221</a></span> <a class="code" href="fixed__point_8h.xhtml#a8900371ff8da316eea9c61c993043ca5">MULQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a">qs8x8</a>, <a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>)</div><div class="line"><a name="l00222"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#af09044372ea5862497f62c8bd76ba035"> 222</a></span> <a class="code" href="fixed__point_8h.xhtml#a8900371ff8da316eea9c61c993043ca5">MULQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ad7f60c2ef8f8b80da7fd81570db06d4a">qs16x8</a>, <a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00223"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a563cc8014b17755a99e1ecac00a2c7f7"> 223</a></span> <a class="code" href="fixed__point_8h.xhtml#a8900371ff8da316eea9c61c993043ca5">MULQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5a2cc1a836612185f0378de9e7159e27">qs8x16</a>, <a class="code" href="fixed__point_8h.xhtml#a16a82528f3e1c6eb81fd9aac6ad45e62">qs16x16</a>)</div><div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a532c6df4b17f88f0e126a97c6e9670ee"> 224</a></span> <a class="code" href="fixed__point_8h.xhtml#a8900371ff8da316eea9c61c993043ca5">MULQ_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a16a82528f3e1c6eb81fd9aac6ad45e62">qs16x16</a>, <a class="code" href="fixed__point_8h.xhtml#a7e505a06809f9ab428dd0ba9be1ea35e">qs32x16</a>)</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span> </div><div class="line"><a name="l00226"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afadf927c77d81f7dcd9af28b65c9c79d"> 226</a></span> <span class="preprocessor">#define MUL_OP_EXPAND_STR(a, b, type, size, position) mul_##type##x##size((a), (b), (position))</span></div><div class="line"><a name="l00227"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1b9871e1733f3827061df926120f9f46"> 227</a></span> <span class="preprocessor">#define MUL_OP_EXPAND(a, b, type, size, position) MUL_OP_EXPAND_STR(a, b, type, size, position)</span></div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span> </div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span> <span class="comment">/* Saturate multiply of two fixed point numbers</span></div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span> <span class="comment"> *</span></div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> <span class="comment"> * @param[in] type the actual data type.</span></div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> <span class="comment"> * @param[in] itype the intermediate data type.</span></div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span> <span class="comment"> *</span></div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span> <span class="comment"> * @return The result of the fixed point multiplication. The result is saturated in case of overflow</span></div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> <span class="comment"> */</span></div><div class="line"><a name="l00236"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f"> 236</a></span> <span class="preprocessor">#define MULQ_SAT_IMPL(type, itype) \</span></div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span> <span class="preprocessor"> inline type mul_sat_##type(type VopA, type VopB, int fixed_point_position) \</span></div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span> <span class="preprocessor"> itype round_val = (itype)(1 << (fixed_point_position - 1)); \</span></div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span> <span class="preprocessor"> itype res = mad_sat(CONVERT((VopA), itype), CONVERT((VopB), itype), round_val); \</span></div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span> <span class="preprocessor"> return CONVERT_SAT((res >> (itype)fixed_point_position), type); \</span></div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span> </div><div class="line"><a name="l00244"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a3508d76a5262f5f3dbf278d7efcf5db9"> 244</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a230d9b32261264756a0d3d4971964753">qs8x1</a>, <a class="code" href="fixed__point_8h.xhtml#aab72e548e91d1bac44d0a8503dfa12e7">qs16x1</a>)</div><div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad1bf1fe4122e578d1d6f7eb9c922da2e"> 245</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3ab174b05a269317ec18680b5c781a04">qs8x2</a>, <a class="code" href="fixed__point_8h.xhtml#ac120446f465238102c2ba0a23ae4aa47">qs16x2</a>)</div><div class="line"><a name="l00246"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a0a2d7bee6c290d0db95ccbe34e7942ad"> 246</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a3b12b782d796ddcf0cd8f8b265be033e">qs8x3</a>, <a class="code" href="fixed__point_8h.xhtml#a39d116772b1400e82b2ab12de00909b0">qs16x3</a>)</div><div class="line"><a name="l00247"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ab24ca3f7f3f023d8503a1752515e15d4"> 247</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a10dfbf9412b518cd160133b68e2da8fd">qs8x4</a>, <a class="code" href="fixed__point_8h.xhtml#a5e34d3e41af677765369d33a3871d95f">qs16x4</a>)</div><div class="line"><a name="l00248"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#adc933417ba0492a4da555044652a7641"> 248</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a8362e532b9c16e2367f9102963b6336a">qs8x8</a>, qs16x8)</div><div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a286a2ecb07602fd7268d31c6e88e62a6"> 249</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(qs8x16, qs16x16)</div><div class="line"><a name="l00250"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4b96bef18b8c9ed279273359d259ed65"> 250</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#aab72e548e91d1bac44d0a8503dfa12e7">qs16x1</a>, <a class="code" href="fixed__point_8h.xhtml#a513b425c3ee001dddfdde427947ccf00">qs32x1</a>)</div><div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a9ef4b9bede0acae7940ecf1e7e58a492"> 251</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#ac120446f465238102c2ba0a23ae4aa47">qs16x2</a>, <a class="code" href="fixed__point_8h.xhtml#addf730860de5f7752f0c85a385088e96">qs32x2</a>)</div><div class="line"><a name="l00252"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aef217f3d96eaf598c4225453833c0222"> 252</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a39d116772b1400e82b2ab12de00909b0">qs16x3</a>, <a class="code" href="fixed__point_8h.xhtml#abf77757e07132c678f7146c860e80fe1">qs32x3</a>)</div><div class="line"><a name="l00253"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a2162dab7e4d7d503d1262b9ffc257a21"> 253</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a5e34d3e41af677765369d33a3871d95f">qs16x4</a>, <a class="code" href="fixed__point_8h.xhtml#a3df1d8363c18bb92b3451d41c6bfc891">qs32x4</a>)</div><div class="line"><a name="l00254"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a93fefd4972b6b9440c8371509b46d19e"> 254</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(qs16x8, <a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00255"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aba68d5b1e592d5b12beb6f9e05e72ed2"> 255</a></span> <a class="code" href="fixed__point_8h.xhtml#a329eb419d445e448ec885a2f69a1fb0f">MULQ_SAT_IMPL</a>(qs16x16, <a class="code" href="fixed__point_8h.xhtml#a7e505a06809f9ab428dd0ba9be1ea35e">qs32x16</a>)</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div><div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4e160e8fcff1c5ec8fba57505cb0ad91"> 257</a></span> <span class="preprocessor">#define MUL_SAT_OP_EXPAND_STR(a, b, type, size, position) mul_sat_##type##x##size((a), (b), (position))</span></div><div class="line"><a name="l00258"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6b559f5128a43015ffc6c855cf84c243"> 258</a></span> <span class="preprocessor">#define MUL_SAT_OP_EXPAND(a, b, type, size, position) MUL_SAT_OP_EXPAND_STR(a, b, type, size, position)</span></div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span> </div><div class="line"><a name="l00267"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a31a4619a484c58adcd6e7a9a8354cf23"> 267</a></span> <span class="preprocessor">#define MLAQ_SAT_IMPL(type, itype) \</span></div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span> <span class="preprocessor"> type mla_sat_##type(type VopA, type VopB, type VopC, int fixed_point_position) \</span></div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span> <span class="preprocessor"> itype res = mad_sat(CONVERT(VopB, itype), CONVERT(VopC, itype), (itype)(1 << (fixed_point_position - 1))); \</span></div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> <span class="preprocessor"> return add_sat(VopA, CONVERT_SAT(res >> (itype)fixed_point_position, type)); \</span></div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> </div><div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a85dee8b5dd48bfc059c5d6397557b562"> 274</a></span> <a class="code" href="fixed__point_8h.xhtml#a31a4619a484c58adcd6e7a9a8354cf23">MLAQ_SAT_IMPL</a>(qs8x8, qs16x8)</div><div class="line"><a name="l00275"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad59f32bf4f61044a698ff4da02080e5a"> 275</a></span> <a class="code" href="fixed__point_8h.xhtml#a31a4619a484c58adcd6e7a9a8354cf23">MLAQ_SAT_IMPL</a>(qs8x16, qs16x16)</div><div class="line"><a name="l00276"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7a3c295a894e0529251bd4529b36a574"> 276</a></span> <a class="code" href="fixed__point_8h.xhtml#a31a4619a484c58adcd6e7a9a8354cf23">MLAQ_SAT_IMPL</a>(qs16x8, <a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span> </div><div class="line"><a name="l00278"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8cde8777703946ea2e06b20d6831d489"> 278</a></span> <span class="preprocessor">#define MLA_SAT_OP_EXPAND_STR(a, b, c, type, size, position) mla_sat_##type##x##size((a), (b), (c), (position))</span></div><div class="line"><a name="l00279"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8a25ee378391e23386ca195249610562"> 279</a></span> <span class="preprocessor">#define MLA_SAT_OP_EXPAND(a, b, c, type, size, position) MLA_SAT_OP_EXPAND_STR(a, b, c, type, size, position)</span></div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span> </div><div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a2258d987499bd7c92db2c90977fd2409"> 288</a></span> <span class="preprocessor">#define MLALQ_SAT_IMPL(type, itype) \</span></div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span> <span class="preprocessor"> itype mlal_sat_##type(itype VopA, type VopB, type VopC, int fixed_point_position) \</span></div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span> <span class="preprocessor"> itype res = mad_sat(CONVERT(VopB, itype), CONVERT(VopC, itype), (itype)(1 << (fixed_point_position - 1))); \</span></div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span> <span class="preprocessor"> return add_sat(VopA, res >> (itype)fixed_point_position); \</span></div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span> </div><div class="line"><a name="l00295"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a09f5d764b62b47a1894a4cb71a0a62f6"> 295</a></span> <a class="code" href="fixed__point_8h.xhtml#a2258d987499bd7c92db2c90977fd2409">MLALQ_SAT_IMPL</a>(qs8x8, qs16x8)</div><div class="line"><a name="l00296"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a50b6bfd3a44a0ac605e88135e230d1e5"> 296</a></span> <a class="code" href="fixed__point_8h.xhtml#a2258d987499bd7c92db2c90977fd2409">MLALQ_SAT_IMPL</a>(qs16x8, <a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span> </div><div class="line"><a name="l00298"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a80b890755bdc8392bcc853d24b34682d"> 298</a></span> <span class="preprocessor">#define MLAL_SAT_OP_EXPAND_STR(a, b, c, type, size, position) mlal_sat_##type##x##size((a), (b), (c), (position))</span></div><div class="line"><a name="l00299"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac52a40b99b01208c76483ee00b96ba9e"> 299</a></span> <span class="preprocessor">#define MLAL_SAT_OP_EXPAND(a, b, c, type, size, position) MLAL_SAT_OP_EXPAND_STR(a, b, c, type, size, position)</span></div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span> </div><div class="line"><a name="l00309"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b"> 309</a></span> <span class="preprocessor">#define DIVQ_SAT_IMPL(stype, type, itype) \</span></div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> <span class="preprocessor"> inline type div_sat_##type(type VopA, type VopB, int fixed_point_position) \</span></div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> <span class="preprocessor"> itype conv_a = CONVERT((VopA), itype); \</span></div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span> <span class="preprocessor"> itype denominator = CONVERT((VopB), itype); \</span></div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span> <span class="preprocessor"> itype numerator = conv_a << (itype)(fixed_point_position); \</span></div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span> <span class="preprocessor"> itype res = select((itype)(numerator / denominator), select((itype)stype##_MAX, (itype)stype##_MIN, (itype)(conv_a < (itype)0)), (itype)(denominator == (itype)0)); \</span></div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span> <span class="preprocessor"> return CONVERT_SAT((res), type); \</span></div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span> </div><div class="line"><a name="l00319"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a524ddfb8ca9b49eb0870b73ee3bd720c"> 319</a></span> <a class="code" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b">DIVQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a96d48f67de90aaed492da7fb7a006b94">qs8</a>, qs8x16, qs16x16)</div><div class="line"><a name="l00320"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae915e52782d10b155502837e6caa9721"> 320</a></span> <a class="code" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b">DIVQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a26a8ca855cd14b1867173d301baf6c4f">qs16</a>, qs16x8, <a class="code" href="fixed__point_8h.xhtml#af8a54f984958bddf4f24cd95867a82f5">qs32x8</a>)</div><div class="line"><a name="l00321"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#af57ae5abe45efdd8ec58130e3d4726cb"> 321</a></span> <a class="code" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b">DIVQ_SAT_IMPL</a>(qs16, qs16x16, <a class="code" href="fixed__point_8h.xhtml#a7e505a06809f9ab428dd0ba9be1ea35e">qs32x16</a>)</div><div class="line"><a name="l00322"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a77995d58e1505e2182a75ee199d8b01e"> 322</a></span> <a class="code" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b">DIVQ_SAT_IMPL</a>(<a class="code" href="fixed__point_8h.xhtml#a96d48f67de90aaed492da7fb7a006b94">qs8</a>, qs8, qs16)</div><div class="line"><a name="l00323"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a8d2c17065a15f7b298145b13c28ef349"> 323</a></span> <a class="code" href="fixed__point_8h.xhtml#aac0b47414a86d32e5c891ab6a75b313b">DIVQ_SAT_IMPL</a>(qs16, qs16, <a class="code" href="fixed__point_8h.xhtml#a8115de4a1860a9bf15e13f4ebfdb707f">qs32</a>)</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span> </div><div class="line"><a name="l00325"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac2995f9506cbc5c918ecf47f447bcfce"> 325</a></span> <span class="preprocessor">#define DIV_SAT_OP_EXPAND_STR(a, b, type, position) div_sat_##type((a), (b), (position))</span></div><div class="line"><a name="l00326"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa13fe0d2ecef3e5b22315baf39715e46"> 326</a></span> <span class="preprocessor">#define DIV_SAT_OP_EXPAND(a, b, type, position) DIV_SAT_OP_EXPAND_STR(a, b, type, position)</span></div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span> </div><div class="line"><a name="l00328"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6ad4d9db82a42c5266cba5e0f317998c"> 328</a></span> <span class="preprocessor">#define DIV_SAT_OP_VEC_EXPAND_STR(a, b, type, size, position) div_sat_##type##x##size((a), (b), (position))</span></div><div class="line"><a name="l00329"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a774126960511e4d827f0d2d3d68abe97"> 329</a></span> <span class="preprocessor">#define DIV_SAT_OP_VEC_EXPAND(a, b, type, size, position) DIV_SAT_OP_VEC_EXPAND_STR(a, b, type, size, position)</span></div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> </div><div class="line"><a name="l00341"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949"> 341</a></span> <span class="preprocessor">#define EXPQ_IMPL(stype, type, size) \</span></div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span> <span class="preprocessor"> inline type exp_sat_##type(type VopA, int fixed_point_position) \</span></div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span> <span class="preprocessor"> type const_one = (type)(1 << (fixed_point_position)); \</span></div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span> <span class="preprocessor"> type ln2 = (type)((((0x58B9 >> (14 - fixed_point_position))) + 1) >> 1); \</span></div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span> <span class="preprocessor"> type inv_ln2 = (type)((((0x38AA >> (14 - fixed_point_position)) + 1) >> 1)) | const_one; \</span></div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span> <span class="preprocessor"> type A = (type)(((0x7FBA >> (14 - fixed_point_position)) + 1) >> 1); \</span></div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span> <span class="preprocessor"> type B = (type)(((0x3FE9 >> (14 - fixed_point_position)) + 1) >> 1); \</span></div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span> <span class="preprocessor"> type C = (type)(((0x1693 >> (14 - fixed_point_position)) + 1) >> 1); \</span></div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span> <span class="preprocessor"> type D = (type)(((0x0592 >> (14 - fixed_point_position)) + 1) >> 1); \</span></div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span> <span class="preprocessor"> type m = MUL_SAT_OP_EXPAND(VopA, inv_ln2, stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span> <span class="preprocessor"> type dec_m = m >> (type)fixed_point_position; \</span></div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span> <span class="preprocessor"> type alpha = MUL_SAT_OP_EXPAND(dec_m << (type)fixed_point_position, ln2, stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> <span class="preprocessor"> alpha = CONVERT(abs_diff(VopA, alpha), type); \</span></div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="preprocessor"> type sum = add_sat(MUL_SAT_OP_EXPAND(alpha, D, stype, size, fixed_point_position), C); \</span></div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span> <span class="preprocessor"> sum = add_sat(MUL_SAT_OP_EXPAND(alpha, sum, stype, size, fixed_point_position), B); \</span></div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span> <span class="preprocessor"> sum = add_sat(MUL_SAT_OP_EXPAND(alpha, sum, stype, size, fixed_point_position), A); \</span></div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span> <span class="preprocessor"> sum = add_sat(MUL_SAT_OP_EXPAND(alpha, sum, stype, size, fixed_point_position), const_one); \</span></div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span> <span class="preprocessor"> return select((type)stype##_MAX, select(sum << dec_m, sum >> -dec_m, dec_m < (type)0), clz(sum) > dec_m); </span><span class="comment">/* Saturate result if needed */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div><div class="line"><a name="l00362"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae360859290b2e6b78dd9d992bb456e2f"> 362</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs8, qs8x2, 2)</div><div class="line"><a name="l00363"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac473935497b3ffcc5683b51a8bbae135"> 363</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs8, qs8x4, 4)</div><div class="line"><a name="l00364"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a6cb9c026b31ee1685cc1c76bab2474a7"> 364</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs8, qs8x8, 8)</div><div class="line"><a name="l00365"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a566d1090e790e168a58a3dd6dcea2476"> 365</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs8, qs8x16, 16)</div><div class="line"><a name="l00366"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac715687e38ad0f8e12a4c2b7f6665a3d"> 366</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs16, qs16x2, 2)</div><div class="line"><a name="l00367"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a2f881d9b68ef31f391f2afa4e329fe6e"> 367</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs16, qs16x4, 4)</div><div class="line"><a name="l00368"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#acbc9ca80c6c37594584af82b36078cb8"> 368</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs16, qs16x8, 8)</div><div class="line"><a name="l00369"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a718889c3f240b9e020d6f507f2c16a31"> 369</a></span> <a class="code" href="fixed__point_8h.xhtml#ae64808afdc06c77889f1bb0565905949">EXPQ_IMPL</a>(qs16, qs16x16, 16)</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span> </div><div class="line"><a name="l00371"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a368a98fe336caf8c24840c67735cd04e"> 371</a></span> <span class="preprocessor">#define EXP_OP_EXPAND_STR(a, type, size, position) exp_sat_##type##x##size((a), (position))</span></div><div class="line"><a name="l00372"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a80482c3ae2b0e68658f84f081a6fbdde"> 372</a></span> <span class="preprocessor">#define EXP_OP_EXPAND(a, type, size, position) EXP_OP_EXPAND_STR(a, type, size, position)</span></div><div class="line"><a name="l00373"></a><span class="lineno"> 373</span> </div><div class="line"><a name="l00384"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a902ecdf01fd8a0760e4ef66ce5814a20"> 384</a></span> <span class="preprocessor">#define LOGQ_IMPL(stype, type, size) \</span></div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span> <span class="preprocessor"> inline type log_sat_##type(type VopA, int fixed_point_position) \</span></div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span> <span class="preprocessor"> type const_one = (type)(1 << (fixed_point_position)); \</span></div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span> <span class="preprocessor"> type ln2 = (type)(0x58B9 >> (15 - fixed_point_position)); </span><span class="comment">/* 1.4384189 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span> <span class="preprocessor"> type A = (type)(0x5C0F >> (14 - fixed_point_position)); </span><span class="comment">/* 1.4384189 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span> <span class="preprocessor"> type B = -(type)(0x56AE >> (15 - fixed_point_position)); </span><span class="comment">/* -0.6771900 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span> <span class="preprocessor"> type C = (type)(0x2933 >> (15 - fixed_point_position)); </span><span class="comment">/* 0.3218538 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span> <span class="preprocessor"> type D = -(type)(0x0AA7 >> (15 - fixed_point_position)); </span><span class="comment">/* -0.0832229 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span> <span class="preprocessor"> type inter_a = select(VopA, DIV_SAT_OP_VEC_EXPAND(const_one, VopA, stype, size, fixed_point_position), VopA < const_one); \</span></div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span> <span class="preprocessor"> type shift_val = (type)(15 - stype##_SHIFT) - clz(inter_a >> (type)fixed_point_position); \</span></div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span> <span class="preprocessor"> inter_a = inter_a >> shift_val; \</span></div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> <span class="preprocessor"> inter_a = sub_sat(inter_a, const_one); \</span></div><div class="line"><a name="l00397"></a><span class="lineno"> 397</span> <span class="preprocessor"> type sum = add_sat(MUL_SAT_OP_EXPAND(inter_a, D, stype, size, fixed_point_position), C); \</span></div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span> <span class="preprocessor"> sum = add_sat(MUL_SAT_OP_EXPAND(inter_a, sum, stype, size, fixed_point_position), B); \</span></div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span> <span class="preprocessor"> sum = add_sat(MUL_SAT_OP_EXPAND(inter_a, sum, stype, size, fixed_point_position), A); \</span></div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span> <span class="preprocessor"> sum = MUL_SAT_OP_EXPAND(inter_a, sum, stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span> <span class="preprocessor"> sum = MUL_SAT_OP_EXPAND(add_sat(sum, shift_val << (type)fixed_point_position), ln2, stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> <span class="preprocessor"> return select(select(sum, -sum, VopA < const_one), (type)0, VopA < (type)0); </span><span class="comment">/* Saturate result if needed */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span> </div><div class="line"><a name="l00405"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ad6bb50561fbfbbf13f5e1e9a29b5c42d"> 405</a></span> <a class="code" href="fixed__point_8h.xhtml#a902ecdf01fd8a0760e4ef66ce5814a20">LOGQ_IMPL</a>(qs8, qs8x16, 16)</div><div class="line"><a name="l00406"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1d6d8a5bb98c983274473090f9320d53"> 406</a></span> <a class="code" href="fixed__point_8h.xhtml#a902ecdf01fd8a0760e4ef66ce5814a20">LOGQ_IMPL</a>(qs16, qs16x8, 8)</div><div class="line"><a name="l00407"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1e9b9fe0c93606b92d8b4a3f1e28a460"> 407</a></span> <a class="code" href="fixed__point_8h.xhtml#a902ecdf01fd8a0760e4ef66ce5814a20">LOGQ_IMPL</a>(qs16, qs16x16, 16)</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> </div><div class="line"><a name="l00409"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a3ec6148739690f17d7f3811c360802ee"> 409</a></span> <span class="preprocessor">#define LOG_OP_EXPAND_STR(a, type, size, position) log_sat_##type##x##size((a), (position))</span></div><div class="line"><a name="l00410"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a3f3a83902f2dd8bd456d9f8ebc57c3db"> 410</a></span> <span class="preprocessor">#define LOG_OP_EXPAND(a, type, size, position) LOG_OP_EXPAND_STR(a, type, size, position)</span></div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span> </div><div class="line"><a name="l00422"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a39fff507525792a262467c3e145bb181"> 422</a></span> <span class="preprocessor">#define INVSQRTQ_IMPL(stype, type, size) \</span></div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span> <span class="preprocessor"> inline type invsqrt_sat_##type(type VopA, int fixed_point_position) \</span></div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span> <span class="preprocessor"> type const_three = (type)(3 << (fixed_point_position)); \</span></div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span> <span class="preprocessor"> type shift_value = (type)(16 - stype##_SHIFT) - (clz(VopA) + (type)fixed_point_position); \</span></div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span> <span class="preprocessor"> type temp = select((type)(VopA >> shift_value), select((type)stype##_MAX, (type)(VopA << (-shift_value)), (type)(clz(VopA) > (-shift_value))), (type)(shift_value < (type)0)); \</span></div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span> <span class="preprocessor"> type x = temp; \</span></div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span> <span class="preprocessor"> x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \</span></div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span> <span class="preprocessor"> x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \</span></div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span> <span class="preprocessor"> x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \</span></div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> <span class="preprocessor"> if(sizeof((stype)(1)) > 1) </span><span class="comment">/* Perform more iterations if datatype is QS16 */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span> <span class="preprocessor"> x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \</span></div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span> <span class="preprocessor"> x = MUL_SAT_OP_EXPAND(x, sub_sat(const_three, MUL_SAT_OP_EXPAND(MUL_SAT_OP_EXPAND(x, x, stype, size, fixed_point_position), temp, stype, size, fixed_point_position)), stype, size, fixed_point_position) >> 1; \</span></div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span> <span class="preprocessor"> } \</span></div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span> <span class="preprocessor"> type shift_value2 = select(shift_value >> 1, (-shift_value) >> 1, shift_value < (type)0); \</span></div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span> <span class="preprocessor"> return select((type)(x >> shift_value2), select((type)stype##_MAX, (type)(x << shift_value2), (type)(clz(x) > shift_value2)), (type)(shift_value < (type)0)); </span><span class="comment">/* Saturate result if needed */</span><span class="preprocessor"> \</span></div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span> </div><div class="line"><a name="l00441"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a33bc7b5204f1f2f497c5f3b94666317e"> 441</a></span> <a class="code" href="fixed__point_8h.xhtml#a39fff507525792a262467c3e145bb181">INVSQRTQ_IMPL</a>(qs8, <a class="code" href="fixed__point_8h.xhtml#a230d9b32261264756a0d3d4971964753">qs8x1</a>, 1)</div><div class="line"><a name="l00442"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#acb097557fa3cdc2e3deedf10aa9351a8"> 442</a></span> <a class="code" href="fixed__point_8h.xhtml#a39fff507525792a262467c3e145bb181">INVSQRTQ_IMPL</a>(qs16, qs16x1, 1)</div><div class="line"><a name="l00443"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#afd5c6ea7dd791f308a747e14d9b43be8"> 443</a></span> <a class="code" href="fixed__point_8h.xhtml#a39fff507525792a262467c3e145bb181">INVSQRTQ_IMPL</a>(qs8, qs8x16, 16)</div><div class="line"><a name="l00444"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa9b962c25694ea1a195f987763817b55"> 444</a></span> <a class="code" href="fixed__point_8h.xhtml#a39fff507525792a262467c3e145bb181">INVSQRTQ_IMPL</a>(qs16, qs16x8, 8)</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span> </div><div class="line"><a name="l00446"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac001b306b7ead2e6dcc84a93260600b1"> 446</a></span> <span class="preprocessor">#define INVSQRT_OP_EXPAND_STR(a, type, size, position) invsqrt_sat_##type##x##size((a), (position))</span></div><div class="line"><a name="l00447"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a26cc71c52d0d09b4b422c474b52b9b01"> 447</a></span> <span class="preprocessor">#define INVSQRT_OP_EXPAND(a, type, size, position) INVSQRT_OP_EXPAND_STR(a, type, size, position)</span></div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span> </div><div class="line"><a name="l00459"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a341448197978a201091ddc00ea22f9e9"> 459</a></span> <span class="preprocessor">#define TANHQ_IMPL(stype, type, size) \</span></div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> <span class="preprocessor"> inline type tanh_sat_##type(type VopA, int fixed_point_position) \</span></div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span> <span class="preprocessor"> type const_one = (type)(1 << (fixed_point_position)); \</span></div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span> <span class="preprocessor"> type const_two = (type)(2 << (fixed_point_position)); \</span></div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span> <span class="preprocessor"> type exp2x = EXP_OP_EXPAND(MUL_SAT_OP_EXPAND(const_two, VopA, stype, size, fixed_point_position), stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span> <span class="preprocessor"> type num = SUB_SAT_OP_EXPAND(exp2x, const_one, stype, size); \</span></div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span> <span class="preprocessor"> type den = ADD_SAT_OP_EXPAND(exp2x, const_one, stype, size); \</span></div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span> <span class="preprocessor"> return DIV_SAT_OP_VEC_EXPAND(num, den, stype, size, fixed_point_position); \</span></div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span> </div><div class="line"><a name="l00470"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a81b68f5d2332aa3a28bc25979dbddd6d"> 470</a></span> <a class="code" href="fixed__point_8h.xhtml#a341448197978a201091ddc00ea22f9e9">TANHQ_IMPL</a>(qs8, qs8x16, 16)</div><div class="line"><a name="l00471"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a136aa7ac86076272e764a5746eac5dad"> 471</a></span> <a class="code" href="fixed__point_8h.xhtml#a341448197978a201091ddc00ea22f9e9">TANHQ_IMPL</a>(qs16, qs16x8, 8)</div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span> </div><div class="line"><a name="l00473"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a452864cb983782cff458f61397fb00eb"> 473</a></span> <span class="preprocessor">#define TANH_OP_EXPAND_STR(a, type, size, position) tanh_sat_##type##x##size((a), (position))</span></div><div class="line"><a name="l00474"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7033bfe12670e700df8aa3a89f1c592b"> 474</a></span> <span class="preprocessor">#define TANH_OP_EXPAND(a, type, size, position) TANH_OP_EXPAND_STR(a, type, size, position)</span></div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span> </div><div class="line"><a name="l00476"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ab2ab4046b57f5ca70105fc90c25a7d2d"> 476</a></span> <span class="preprocessor">#define floatx16 float16</span></div><div class="line"><a name="l00477"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a7547ee26d654afa7fd5206692a6e6625"> 477</a></span> <span class="preprocessor">#define float16_TYPE float16</span></div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span> </div><div class="line"><a name="l00479"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#acad65c9300736f277c3b8419326f1413"> 479</a></span> <span class="preprocessor">#define CONVERTQ_DOWN_IMPL(in_type, out_type) \</span></div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span> <span class="preprocessor"> inline out_type convert_##out_type##_##in_type(in_type a, int fixed_point_position) \</span></div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> <span class="preprocessor"> return CONVERT(a * (1 << fixed_point_position) + select((in_type)-0.5f, (in_type)0.5f, isgreater(a, (in_type)0)), out_type); \</span></div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span> </div><div class="line"><a name="l00485"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a1ebfbb37946a7197a2a500b1d14631be"> 485</a></span> <a class="code" href="fixed__point_8h.xhtml#acad65c9300736f277c3b8419326f1413">CONVERTQ_DOWN_IMPL</a>(float16, qs8x16)</div><div class="line"><a name="l00486"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae4b030aea69e8c3f34a373c1af8d1674"> 486</a></span> <a class="code" href="fixed__point_8h.xhtml#acad65c9300736f277c3b8419326f1413">CONVERTQ_DOWN_IMPL</a>(float16, qs16x16)</div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span> </div><div class="line"><a name="l00488"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a107bff3ea73b2344cf3bc9795177f5b9"> 488</a></span> <span class="preprocessor">#define CONVERTQ_DOWN_SAT_IMPL(in_type, out_type) \</span></div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span> <span class="preprocessor"> inline out_type convert_##out_type##_##in_type##_sat(in_type a, int fixed_point_position) \</span></div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span> <span class="preprocessor"> return CONVERT_SAT(a * (1 << fixed_point_position) + select((in_type)-0.5f, (in_type)0.5f, isgreater(a, (in_type)0)), out_type); \</span></div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span> </div><div class="line"><a name="l00494"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae5d1cdcf8439f9aeb8a4337ee6497559"> 494</a></span> <a class="code" href="fixed__point_8h.xhtml#a107bff3ea73b2344cf3bc9795177f5b9">CONVERTQ_DOWN_SAT_IMPL</a>(float16, qs8x16)</div><div class="line"><a name="l00495"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ae391ff83d53deb586074fdad54f59d9b"> 495</a></span> <a class="code" href="fixed__point_8h.xhtml#a107bff3ea73b2344cf3bc9795177f5b9">CONVERTQ_DOWN_SAT_IMPL</a>(float16, qs16x16)</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span> </div><div class="line"><a name="l00497"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a91019976b3e97e493e0b00ff9e92a5d3"> 497</a></span> <span class="preprocessor">#define CONVERTQ_UP_IMPL(in_type, out_type) \</span></div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span> <span class="preprocessor"> inline out_type convert_##out_type##_##in_type(in_type a, int fixed_point_position) \</span></div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span> <span class="preprocessor"> return CONVERT(a, out_type) / (1 << fixed_point_position); \</span></div><div class="line"><a name="l00501"></a><span class="lineno"> 501</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span> </div><div class="line"><a name="l00503"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a29e1c935f8ce7d7b3b7125a2bac6fb59"> 503</a></span> <a class="code" href="fixed__point_8h.xhtml#a91019976b3e97e493e0b00ff9e92a5d3">CONVERTQ_UP_IMPL</a>(qs8x16, float16)</div><div class="line"><a name="l00504"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a4dc52ccd303ac120e2940b30b525301d"> 504</a></span> <a class="code" href="fixed__point_8h.xhtml#a91019976b3e97e493e0b00ff9e92a5d3">CONVERTQ_UP_IMPL</a>(qs16x16, float16)</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span> </div><div class="line"><a name="l00506"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a740b5b51d0e06dae628961d373d6c359"> 506</a></span> <span class="preprocessor">#define SQCVT_SAT_IMPL(type) \</span></div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span> <span class="preprocessor"> inline type sqcvt_##type##_sat(float a, int fixed_point_position) \</span></div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span> <span class="preprocessor"> { \</span></div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span> <span class="preprocessor"> return CONVERT_SAT((a * (1 << fixed_point_position) + ((a < 0) ? -0.5f : 0.5f)), type); \</span></div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span> <span class="preprocessor"> }</span></div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span> </div><div class="line"><a name="l00512"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a27b4e171bdfd66f52824f5812c9fa522"> 512</a></span> <a class="code" href="fixed__point_8h.xhtml#a740b5b51d0e06dae628961d373d6c359">SQCVT_SAT_IMPL</a>(qs8)</div><div class="line"><a name="l00513"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#ac1d0a82fd450972cab8a7c85217e4441"> 513</a></span> <a class="code" href="fixed__point_8h.xhtml#a740b5b51d0e06dae628961d373d6c359">SQCVT_SAT_IMPL</a>(qs16)</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span> </div><div class="line"><a name="l00515"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#aa9f86d33cbbf40f33fe1074913ae30d1"> 515</a></span> <span class="preprocessor">#define SQCVT_SAT_OP_EXPAND_STR(a, type, position) sqcvt_##type##_sat((a), (position))</span></div><div class="line"><a name="l00516"></a><span class="lineno"><a class="line" href="fixed__point_8h.xhtml#a40c89e1f1f54dd72fc533c9aafdee12e"> 516</a></span> <span class="preprocessor">#define SQCVT_SAT_OP_EXPAND(a, type, position) SQCVT_SAT_OP_EXPAND_STR((a), type, position)</span></div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span> </div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span> <span class="preprocessor">#endif // ARM_COMPUTE_FIXED_POINT_H</span></div><div class="ttc" id="fixed__point_8h_xhtml_a2258d987499bd7c92db2c90977fd2409"><div class="ttname"><a href="fixed__point_8h.xhtml#a2258d987499bd7c92db2c90977fd2409">MLALQ_SAT_IMPL</a></div><div class="ttdeci">#define MLALQ_SAT_IMPL(type, itype)</div><div class="ttdoc">Saturate multiply-accumulate long. </div><div class="ttdef"><b>Definition:</b> <a href="fixed__point_8h_source.xhtml#l00288">fixed_point.h:288</a></div></div> |