annotate f103c8/Drivers/CMSIS/DSP_Lib/Source/BasicMathFunctions/arm_scale_q31.c @ 6:ca42336826bd default tip

working on clock sources
author cin
date Mon, 23 Jan 2017 02:40:17 +0300
parents 0c59e7a7782a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /* ----------------------------------------------------------------------
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4 * $Date: 19. March 2015
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 * $Revision: V.1.4.5
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 * Project: CMSIS DSP Library
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 * Title: arm_scale_q31.c
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 * Description: Multiplies a Q31 vector by a scalar.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 * Redistribution and use in source and binary forms, with or without
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 * modification, are permitted provided that the following conditions
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 * are met:
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 * - Redistributions of source code must retain the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 * notice, this list of conditions and the following disclaimer.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 * - Redistributions in binary form must reproduce the above copyright
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 * notice, this list of conditions and the following disclaimer in
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 * the documentation and/or other materials provided with the
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 * distribution.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 * - Neither the name of ARM LIMITED nor the names of its contributors
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 * may be used to endorse or promote products derived from this
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 * software without specific prior written permission.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 * POSSIBILITY OF SUCH DAMAGE.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39 * -------------------------------------------------------------------- */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 #include "arm_math.h"
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 * @ingroup groupMath
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 * @addtogroup scale
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 * @{
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 * @brief Multiplies a Q31 vector by a scalar.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 * @param[in] *pSrc points to the input vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 * @param[in] scaleFract fractional portion of the scale value
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 * @param[in] shift number of bits to shift the result by
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57 * @param[out] *pDst points to the output vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 * @param[in] blockSize number of samples in the vector
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 * @return none.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 *
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 * <b>Scaling and Overflow Behavior:</b>
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 * \par
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 * The input data <code>*pSrc</code> and <code>scaleFract</code> are in 1.31 format.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 * These are multiplied to yield a 2.62 intermediate result and this is shifted with saturation to 1.31 format.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67 void arm_scale_q31(
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 q31_t * pSrc,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 q31_t scaleFract,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70 int8_t shift,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 q31_t * pDst,
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 uint32_t blockSize)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74 int8_t kShift = shift + 1; /* Shift to apply after scaling */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 int8_t sign = (kShift & 0x80);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 uint32_t blkCnt; /* loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 q31_t in, out;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 #ifndef ARM_MATH_CM0_FAMILY
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 /* Run the below code for Cortex-M4 and Cortex-M3 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83 q31_t in1, in2, in3, in4; /* temporary input variables */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 q31_t out1, out2, out3, out4; /* temporary output variabels */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 /*loop Unrolling */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 blkCnt = blockSize >> 2u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90 if(sign == 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 ** a second loop below computes the remaining 1 to 3 samples. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 /* read four inputs from source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 in1 = *pSrc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 in2 = *(pSrc + 1);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 in3 = *(pSrc + 2);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 in4 = *(pSrc + 3);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 /* multiply input with scaler value */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 in1 = ((q63_t) in1 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 in2 = ((q63_t) in2 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 in3 = ((q63_t) in3 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 in4 = ((q63_t) in4 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 /* apply shifting */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 out1 = in1 << kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 out2 = in2 << kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 /* saturate the results. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 if(in1 != (out1 >> kShift))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114 out1 = 0x7FFFFFFF ^ (in1 >> 31);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 if(in2 != (out2 >> kShift))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 out2 = 0x7FFFFFFF ^ (in2 >> 31);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 out3 = in3 << kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 out4 = in4 << kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122 *pDst = out1;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 *(pDst + 1) = out2;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 if(in3 != (out3 >> kShift))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126 out3 = 0x7FFFFFFF ^ (in3 >> 31);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 if(in4 != (out4 >> kShift))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 out4 = 0x7FFFFFFF ^ (in4 >> 31);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 /* Store result destination */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 *(pDst + 2) = out3;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 *(pDst + 3) = out4;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 /* Update pointers to process next sampels */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 pSrc += 4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 pDst += 4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 /* First part of the processing with loop unrolling. Compute 4 outputs at a time.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 ** a second loop below computes the remaining 1 to 3 samples. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 /* read four inputs from source */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 in1 = *pSrc;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 in2 = *(pSrc + 1);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 in3 = *(pSrc + 2);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154 in4 = *(pSrc + 3);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156 /* multiply input with scaler value */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 in1 = ((q63_t) in1 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 in2 = ((q63_t) in2 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 in3 = ((q63_t) in3 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 in4 = ((q63_t) in4 * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 /* apply shifting */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163 out1 = in1 >> -kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164 out2 = in2 >> -kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 out3 = in3 >> -kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167 out4 = in4 >> -kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
169 /* Store result destination */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
170 *pDst = out1;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
171 *(pDst + 1) = out2;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
172
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
173 *(pDst + 2) = out3;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
174 *(pDst + 3) = out4;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
175
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
176 /* Update pointers to process next sampels */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
177 pSrc += 4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
178 pDst += 4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
179
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
180 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
181 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
182 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
183 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
184 /* If the blockSize is not a multiple of 4, compute any remaining output samples here.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
185 ** No loop unrolling is used. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
186 blkCnt = blockSize % 0x4u;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
187
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
188 #else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
189
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
190 /* Run the below code for Cortex-M0 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
191
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
192 /* Initialize blkCnt with number of samples */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
193 blkCnt = blockSize;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
194
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
195 #endif /* #ifndef ARM_MATH_CM0_FAMILY */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
196
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
197 if(sign == 0)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
198 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
199 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
200 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
201 /* C = A * scale */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
202 /* Scale the input and then store the result in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
203 in = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
204 in = ((q63_t) in * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
205
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
206 out = in << kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
207
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
208 if(in != (out >> kShift))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
209 out = 0x7FFFFFFF ^ (in >> 31);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
210
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
211 *pDst++ = out;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
212
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
213 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
214 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
215 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
216 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
217 else
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
218 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
219 while(blkCnt > 0u)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
220 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
221 /* C = A * scale */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
222 /* Scale the input and then store the result in the destination buffer. */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
223 in = *pSrc++;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
224 in = ((q63_t) in * scaleFract) >> 32;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
225
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
226 out = in >> -kShift;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
227
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
228 *pDst++ = out;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
229
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
230 /* Decrement the loop counter */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
231 blkCnt--;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
232 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
233
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
234 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
235 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
236
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
237 /**
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
238 * @} end of scale group
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
239 */