<! 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"/>
<title>CMSIS DSP Software Library: arm_sin_q31.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox. OnSelectItem(0);'>
<!--  Generated by Doxygen 1.7.2 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox. OnSearchSelectShow()"
               onmouseout="return searchBox. OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox. OnSearchFieldFocus(true)" 
               onblur="searchBox. OnSearchFieldFocus(false)" 
               onkeyup="searchBox. OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox. CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>arm_sin_q31.c</h1>  </div>
</div>
<div class="contents">
<a href="arm__sin__q31_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* ----------------------------------------------------------------------   </span>
<a name="l00002"></a>00002 <span class="comment">* Copyright (C) 2010 ARM Limited.  All rights reserved.    </span>
<a name="l00003"></a>00003 <span class="comment">*   </span>
<a name="l00004"></a>00004 <span class="comment">* $Date:        15.  July 2011  </span>
<a name="l00005"></a>00005 <span class="comment">* $Revision:    V1.0.10  </span>
<a name="l00006"></a>00006 <span class="comment">*   </span>
<a name="l00007"></a>00007 <span class="comment">* Project:      CMSIS DSP Library   </span>
<a name="l00008"></a>00008 <span class="comment">* Title:        arm_sin_q31.c   </span>
<a name="l00009"></a>00009 <span class="comment">*   </span>
<a name="l00010"></a>00010 <span class="comment">* Description:  Fast sine calculation for Q31 values.   </span>
<a name="l00011"></a>00011 <span class="comment">*   </span>
<a name="l00012"></a>00012 <span class="comment">* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0</span>
<a name="l00013"></a>00013 <span class="comment">*  </span>
<a name="l00014"></a>00014 <span class="comment">* Version 1.0.10 2011/7/15 </span>
<a name="l00015"></a>00015 <span class="comment">*    Big Endian support added and Merged M0 and M3/M4 Source code.   </span>
<a name="l00016"></a>00016 <span class="comment">*   </span>
<a name="l00017"></a>00017 <span class="comment">* Version 1.0.3 2010/11/29  </span>
<a name="l00018"></a>00018 <span class="comment">*    Re-organized the CMSIS folders and updated documentation.    </span>
<a name="l00019"></a>00019 <span class="comment">*    </span>
<a name="l00020"></a>00020 <span class="comment">* Version 1.0.2 2010/11/11   </span>
<a name="l00021"></a>00021 <span class="comment">*    Documentation updated.     </span>
<a name="l00022"></a>00022 <span class="comment">*   </span>
<a name="l00023"></a>00023 <span class="comment">* Version 1.0.1 2010/10/05    </span>
<a name="l00024"></a>00024 <span class="comment">*    Production release and review comments incorporated.    </span>
<a name="l00025"></a>00025 <span class="comment">*   </span>
<a name="l00026"></a>00026 <span class="comment">* Version 1.0.0 2010/09/20    </span>
<a name="l00027"></a>00027 <span class="comment">*    Production release and review comments incorporated.    </span>
<a name="l00028"></a>00028 <span class="comment">* -------------------------------------------------------------------- */</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="arm__math_8h.html">arm_math.h</a>&quot;</span>
<a name="l00031"></a>00031 
<a name="l00059"></a><a class="code" href="group__sin.html#gab1ffde7f3deee5adc75ba8b3d0a53106">00059</a> <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> <a class="code" href="group__sin.html#gab1ffde7f3deee5adc75ba8b3d0a53106">sinTableQ31</a>[259] = {
<a name="l00060"></a>00060   0xfcdbd541, 0x0, 0x3242abf, 0x647d97c, 0x96a9049, 0xc8bd35e, 0xfab272b,
<a name="l00061"></a>00061   0x12c8106f,
<a name="l00062"></a>00062   0x15e21445, 0x18f8b83c, 0x1c0b826a, 0x1f19f97b, 0x2223a4c5, 0x25280c5e,
<a name="l00063"></a>00063   0x2826b928, 0x2b1f34eb,
<a name="l00064"></a>00064   0x2e110a62, 0x30fbc54d, 0x33def287, 0x36ba2014, 0x398cdd32, 0x3c56ba70,
<a name="l00065"></a>00065   0x3f1749b8, 0x41ce1e65,
<a name="l00066"></a>00066   0x447acd50, 0x471cece7, 0x49b41533, 0x4c3fdff4, 0x4ebfe8a5, 0x5133cc94,
<a name="l00067"></a>00067   0x539b2af0, 0x55f5a4d2,
<a name="l00068"></a>00068   0x5842dd54, 0x5a82799a, 0x5cb420e0, 0x5ed77c8a, 0x60ec3830, 0x62f201ac,
<a name="l00069"></a>00069   0x64e88926, 0x66cf8120,
<a name="l00070"></a>00070   0x68a69e81, 0x6a6d98a4, 0x6c242960, 0x6dca0d14, 0x6f5f02b2, 0x70e2cbc6,
<a name="l00071"></a>00071   0x72552c85, 0x73b5ebd1,
<a name="l00072"></a>00072   0x7504d345, 0x7641af3d, 0x776c4edb, 0x78848414, 0x798a23b1, 0x7a7d055b,
<a name="l00073"></a>00073   0x7b5d039e, 0x7c29fbee,
<a name="l00074"></a>00074   0x7ce3ceb2, 0x7d8a5f40, 0x7e1d93ea, 0x7e9d55fc, 0x7f0991c4, 0x7f62368f,
<a name="l00075"></a>00075   0x7fa736b4, 0x7fd8878e,
<a name="l00076"></a>00076   0x7ff62182, 0x7fffffff, 0x7ff62182, 0x7fd8878e, 0x7fa736b4, 0x7f62368f,
<a name="l00077"></a>00077   0x7f0991c4, 0x7e9d55fc,
<a name="l00078"></a>00078   0x7e1d93ea, 0x7d8a5f40, 0x7ce3ceb2, 0x7c29fbee, 0x7b5d039e, 0x7a7d055b,
<a name="l00079"></a>00079   0x798a23b1, 0x78848414,
<a name="l00080"></a>00080   0x776c4edb, 0x7641af3d, 0x7504d345, 0x73b5ebd1, 0x72552c85, 0x70e2cbc6,
<a name="l00081"></a>00081   0x6f5f02b2, 0x6dca0d14,
<a name="l00082"></a>00082   0x6c242960, 0x6a6d98a4, 0x68a69e81, 0x66cf8120, 0x64e88926, 0x62f201ac,
<a name="l00083"></a>00083   0x60ec3830, 0x5ed77c8a,
<a name="l00084"></a>00084   0x5cb420e0, 0x5a82799a, 0x5842dd54, 0x55f5a4d2, 0x539b2af0, 0x5133cc94,
<a name="l00085"></a>00085   0x4ebfe8a5, 0x4c3fdff4,
<a name="l00086"></a>00086   0x49b41533, 0x471cece7, 0x447acd50, 0x41ce1e65, 0x3f1749b8, 0x3c56ba70,
<a name="l00087"></a>00087   0x398cdd32, 0x36ba2014,
<a name="l00088"></a>00088   0x33def287, 0x30fbc54d, 0x2e110a62, 0x2b1f34eb, 0x2826b928, 0x25280c5e,
<a name="l00089"></a>00089   0x2223a4c5, 0x1f19f97b,
<a name="l00090"></a>00090   0x1c0b826a, 0x18f8b83c, 0x15e21445, 0x12c8106f, 0xfab272b, 0xc8bd35e,
<a name="l00091"></a>00091   0x96a9049, 0x647d97c,
<a name="l00092"></a>00092   0x3242abf, 0x0, 0xfcdbd541, 0xf9b82684, 0xf6956fb7, 0xf3742ca2, 0xf054d8d5,
<a name="l00093"></a>00093   0xed37ef91,
<a name="l00094"></a>00094   0xea1debbb, 0xe70747c4, 0xe3f47d96, 0xe0e60685, 0xdddc5b3b, 0xdad7f3a2,
<a name="l00095"></a>00095   0xd7d946d8, 0xd4e0cb15,
<a name="l00096"></a>00096   0xd1eef59e, 0xcf043ab3, 0xcc210d79, 0xc945dfec, 0xc67322ce, 0xc3a94590,
<a name="l00097"></a>00097   0xc0e8b648, 0xbe31e19b,
<a name="l00098"></a>00098   0xbb8532b0, 0xb8e31319, 0xb64beacd, 0xb3c0200c, 0xb140175b, 0xaecc336c,
<a name="l00099"></a>00099   0xac64d510, 0xaa0a5b2e,
<a name="l00100"></a>00100   0xa7bd22ac, 0xa57d8666, 0xa34bdf20, 0xa1288376, 0x9f13c7d0, 0x9d0dfe54,
<a name="l00101"></a>00101   0x9b1776da, 0x99307ee0,
<a name="l00102"></a>00102   0x9759617f, 0x9592675c, 0x93dbd6a0, 0x9235f2ec, 0x90a0fd4e, 0x8f1d343a,
<a name="l00103"></a>00103   0x8daad37b, 0x8c4a142f,
<a name="l00104"></a>00104   0x8afb2cbb, 0x89be50c3, 0x8893b125, 0x877b7bec, 0x8675dc4f, 0x8582faa5,
<a name="l00105"></a>00105   0x84a2fc62, 0x83d60412,
<a name="l00106"></a>00106   0x831c314e, 0x8275a0c0, 0x81e26c16, 0x8162aa04, 0x80f66e3c, 0x809dc971,
<a name="l00107"></a>00107   0x8058c94c, 0x80277872,
<a name="l00108"></a>00108   0x8009de7e, 0x80000000, 0x8009de7e, 0x80277872, 0x8058c94c, 0x809dc971,
<a name="l00109"></a>00109   0x80f66e3c, 0x8162aa04,
<a name="l00110"></a>00110   0x81e26c16, 0x8275a0c0, 0x831c314e, 0x83d60412, 0x84a2fc62, 0x8582faa5,
<a name="l00111"></a>00111   0x8675dc4f, 0x877b7bec,
<a name="l00112"></a>00112   0x8893b125, 0x89be50c3, 0x8afb2cbb, 0x8c4a142f, 0x8daad37b, 0x8f1d343a,
<a name="l00113"></a>00113   0x90a0fd4e, 0x9235f2ec,
<a name="l00114"></a>00114   0x93dbd6a0, 0x9592675c, 0x9759617f, 0x99307ee0, 0x9b1776da, 0x9d0dfe54,
<a name="l00115"></a>00115   0x9f13c7d0, 0xa1288376,
<a name="l00116"></a>00116   0xa34bdf20, 0xa57d8666, 0xa7bd22ac, 0xaa0a5b2e, 0xac64d510, 0xaecc336c,
<a name="l00117"></a>00117   0xb140175b, 0xb3c0200c,
<a name="l00118"></a>00118   0xb64beacd, 0xb8e31319, 0xbb8532b0, 0xbe31e19b, 0xc0e8b648, 0xc3a94590,
<a name="l00119"></a>00119   0xc67322ce, 0xc945dfec,
<a name="l00120"></a>00120   0xcc210d79, 0xcf043ab3, 0xd1eef59e, 0xd4e0cb15, 0xd7d946d8, 0xdad7f3a2,
<a name="l00121"></a>00121   0xdddc5b3b, 0xe0e60685,
<a name="l00122"></a>00122   0xe3f47d96, 0xe70747c4, 0xea1debbb, 0xed37ef91, 0xf054d8d5, 0xf3742ca2,
<a name="l00123"></a>00123   0xf6956fb7, 0xf9b82684,
<a name="l00124"></a>00124   0xfcdbd541, 0x0, 0x3242abf
<a name="l00125"></a>00125 };
<a name="l00126"></a>00126 
<a name="l00127"></a>00127 
<a name="l00136"></a><a class="code" href="group__sin.html#ga57aade7d8892585992cdc6375bd82f9c">00136</a> <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> <a class="code" href="group__sin.html#ga57aade7d8892585992cdc6375bd82f9c" title="Fast approximation to the trigonometric sine function for Q31 data. ">arm_sin_q31</a>(
<a name="l00137"></a>00137   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> x)
<a name="l00138"></a>00138 {
<a name="l00139"></a>00139   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> sinVal, in, in2;                         <span class="comment">/* Temporary variables for input, output */</span>
<a name="l00140"></a>00140   uint32_t index;                                <span class="comment">/* Index variables */</span>
<a name="l00141"></a>00141   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> wa, wb, wc, wd;                          <span class="comment">/* Cubic interpolation coefficients */</span>
<a name="l00142"></a>00142   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> a, b, c, d;                              <span class="comment">/* Four nearest output values */</span>
<a name="l00143"></a>00143   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> *tablePtr;                               <span class="comment">/* Pointer to table */</span>
<a name="l00144"></a>00144   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> fract, fractCube, fractSquare;           <span class="comment">/* Temporary values for fractional values */</span>
<a name="l00145"></a>00145   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> oneBy6 = 0x15555555;                     <span class="comment">/* Fixed point value of 1/6 */</span>
<a name="l00146"></a>00146   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> tableSpacing = <a class="code" href="arm__math_8h.html#a8407c9e1347d10e3bcf0a7014f1fb2ff">TABLE_SPACING_Q31</a>;        <span class="comment">/* Table spacing */</span>
<a name="l00147"></a>00147   <a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> temp;                                    <span class="comment">/* Temporary variable for intermediate process */</span>
<a name="l00148"></a>00148 
<a name="l00149"></a>00149   in = x;
<a name="l00150"></a>00150 
<a name="l00151"></a>00151   <span class="comment">/* Calculate the nearest index */</span>
<a name="l00152"></a>00152   index = (uint32_t) in / (uint32_t) tableSpacing;
<a name="l00153"></a>00153 
<a name="l00154"></a>00154   <span class="comment">/* Calculate the nearest value of input */</span>
<a name="l00155"></a>00155   in2 = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) index *tableSpacing;
<a name="l00156"></a>00156 
<a name="l00157"></a>00157   <span class="comment">/* Calculation of fractional value */</span>
<a name="l00158"></a>00158   fract = (in - in2) &lt;&lt; 8;
<a name="l00159"></a>00159 
<a name="l00160"></a>00160   <span class="comment">/* fractSquare = fract * fract */</span>
<a name="l00161"></a>00161   fractSquare = ((<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) (((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) fract * fract) &gt;&gt; 32));
<a name="l00162"></a>00162   fractSquare = fractSquare &lt;&lt; 1;
<a name="l00163"></a>00163 
<a name="l00164"></a>00164   <span class="comment">/* fractCube = fract * fract * fract */</span>
<a name="l00165"></a>00165   fractCube = ((<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) (((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) fractSquare * fract) &gt;&gt; 32));
<a name="l00166"></a>00166   fractCube = fractCube &lt;&lt; 1;
<a name="l00167"></a>00167 
<a name="l00168"></a>00168   <span class="comment">/* Initialise table pointer */</span>
<a name="l00169"></a>00169   tablePtr = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a> *) &amp; <a class="code" href="group__sin.html#gab1ffde7f3deee5adc75ba8b3d0a53106">sinTableQ31</a>[index];
<a name="l00170"></a>00170 
<a name="l00171"></a>00171   <span class="comment">/* Cubic interpolation process */</span>
<a name="l00172"></a>00172   <span class="comment">/* Calculation of wa */</span>
<a name="l00173"></a>00173   <span class="comment">/* wa = -(oneBy6)*fractCube + (fractSquare &gt;&gt; 1u) - (0x2AAAAAAA)*fract; */</span>
<a name="l00174"></a>00174   wa = ((<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) (((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) oneBy6 * fractCube) &gt;&gt; 32));
<a name="l00175"></a>00175   temp = 0x2AAAAAAA;
<a name="l00176"></a>00176   wa = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) ((((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) wa &lt;&lt; 32) + ((q63_t) temp * fract)) &gt;&gt; 32);
<a name="l00177"></a>00177   wa = -(wa &lt;&lt; 1u);
<a name="l00178"></a>00178   wa += (fractSquare &gt;&gt; 1u);
<a name="l00179"></a>00179 
<a name="l00180"></a>00180   <span class="comment">/* Read first nearest value of output from the sin table */</span>
<a name="l00181"></a>00181   a = *tablePtr++;
<a name="l00182"></a>00182 
<a name="l00183"></a>00183   <span class="comment">/* sinVal = a*wa */</span>
<a name="l00184"></a>00184   sinVal = ((<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) (((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) a * wa) &gt;&gt; 32));
<a name="l00185"></a>00185 
<a name="l00186"></a>00186   <span class="comment">/* q31(1.31) Fixed point value of 1 */</span>
<a name="l00187"></a>00187   temp = 0x7FFFFFFF;
<a name="l00188"></a>00188 
<a name="l00189"></a>00189   <span class="comment">/* Calculation of wb */</span>
<a name="l00190"></a>00190   wb = ((fractCube &gt;&gt; 1u) - (fractSquare + (fract &gt;&gt; 1u))) + temp;
<a name="l00191"></a>00191 
<a name="l00192"></a>00192   <span class="comment">/* Read second nearest value of output from the sin table */</span>
<a name="l00193"></a>00193   b = *tablePtr++;
<a name="l00194"></a>00194 
<a name="l00195"></a>00195   <span class="comment">/*  sinVal += b*wb */</span>
<a name="l00196"></a>00196   sinVal = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) ((((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) sinVal &lt;&lt; 32) + (q63_t) b * (wb)) &gt;&gt; 32);
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <span class="comment">/* Calculation of wc */</span>
<a name="l00199"></a>00199   wc = -fractCube + fractSquare;
<a name="l00200"></a>00200   wc = (wc &gt;&gt; 1u) + fract;
<a name="l00201"></a>00201 
<a name="l00202"></a>00202   <span class="comment">/* Read third nearest value of output from the sin table */</span>
<a name="l00203"></a>00203   c = *tablePtr++;
<a name="l00204"></a>00204 
<a name="l00205"></a>00205   <span class="comment">/*      sinVal += c*wc */</span>
<a name="l00206"></a>00206   sinVal = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) ((((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) sinVal &lt;&lt; 32) + ((q63_t) c * wc)) &gt;&gt; 32);
<a name="l00207"></a>00207 
<a name="l00208"></a>00208   <span class="comment">/* Calculation of wd */</span>
<a name="l00209"></a>00209   <span class="comment">/* wd = (oneBy6) * fractCube - (oneBy6) * fract; */</span>
<a name="l00210"></a>00210   fractCube = fractCube - fract;
<a name="l00211"></a>00211   wd = ((<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) (((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) oneBy6 * fractCube) &gt;&gt; 32));
<a name="l00212"></a>00212   wd = (wd &lt;&lt; 1u);
<a name="l00213"></a>00213 
<a name="l00214"></a>00214   <span class="comment">/* Read fourth nearest value of output from the sin table */</span>
<a name="l00215"></a>00215   d = *tablePtr++;
<a name="l00216"></a>00216 
<a name="l00217"></a>00217   <span class="comment">/* sinVal += d*wd; */</span>
<a name="l00218"></a>00218   sinVal = (<a class="code" href="arm__math_8h.html#adc89a3547f5324b7b3b95adec3806bc0" title="32-bit fractional data type in 1.31 format. ">q31_t</a>) ((((<a class="code" href="arm__math_8h.html#a5aea1cb12fc02d9d44c8abf217eaa5c6" title="64-bit fractional data type in 1.63 format. ">q63_t</a>) sinVal &lt;&lt; 32) + ((q63_t) d * wd)) &gt;&gt; 32);
<a name="l00219"></a>00219 
<a name="l00220"></a>00220   <span class="comment">/* convert sinVal in 2.30 format to 1.31 format */</span>
<a name="l00221"></a>00221   <span class="keywordflow">return</span> (sinVal &lt;&lt; 1u);
<a name="l00222"></a>00222 
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 
</pre></div></div>
</div>
<!---  window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox. OnSearchSelectShow()"
     onmouseout="return searchBox. OnSearchSelectHide()"
     onkeydown="return searchBox. OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox. OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

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

<hr class="footer"/><address class="footer"><small>Generated on Fri Jul 15 2011 13:16:17 for CMSIS DSP Software Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
