Added all the F4 libraries to the project
[fw/stlink] / exampleF4 / CMSIS / DSP_Lib / Source / SupportFunctions / arm_copy_q31.c
1 /* ----------------------------------------------------------------------   
2 * Copyright (C) 2010 ARM Limited. All rights reserved.   
3 *   
4 * $Date:        15. July 2011  
5 * $Revision:    V1.0.10  
6 *   
7 * Project:          CMSIS DSP Library   
8 * Title:                arm_copy_q31.c   
9 *   
10 * Description:  Copies the elements of a Q31 vector.  
11 *   
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
13 *  
14 * Version 1.0.10 2011/7/15 
15 *    Big Endian support added and Merged M0 and M3/M4 Source code.  
16 *   
17 * Version 1.0.3 2010/11/29  
18 *    Re-organized the CMSIS folders and updated documentation.   
19 *    
20 * Version 1.0.2 2010/11/11   
21 *    Documentation updated.    
22 *   
23 * Version 1.0.1 2010/10/05    
24 *    Production release and review comments incorporated.   
25 *   
26 * Version 1.0.0 2010/09/20    
27 *    Production release and review comments incorporated.   
28 *   
29 * Version 0.0.7  2010/06/10    
30 *    Misra-C changes done   
31 * -------------------------------------------------------------------- */
32
33 #include "arm_math.h"
34
35 /**   
36  * @ingroup groupSupport   
37  */
38
39 /**   
40  * @addtogroup copy   
41  * @{   
42  */
43
44 /**   
45  * @brief Copies the elements of a Q31 vector.    
46  * @param[in]       *pSrc points to input vector   
47  * @param[out]      *pDst points to output vector   
48  * @param[in]       blockSize length of the input vector  
49  * @return none.   
50  *   
51  */
52
53 void arm_copy_q31(
54   q31_t * pSrc,
55   q31_t * pDst,
56   uint32_t blockSize)
57 {
58   uint32_t blkCnt;                               /* loop counter */
59
60
61 #ifndef ARM_MATH_CM0
62
63   /* Run the below code for Cortex-M4 and Cortex-M3 */
64
65   /*loop Unrolling */
66   blkCnt = blockSize >> 2u;
67
68   /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.   
69    ** a second loop below computes the remaining 1 to 3 samples. */
70   while(blkCnt > 0u)
71   {
72     /* C = A */
73     /* Copy and then store the values in the destination buffer */
74     *pDst++ = *pSrc++;
75     *pDst++ = *pSrc++;
76     *pDst++ = *pSrc++;
77     *pDst++ = *pSrc++;
78
79     /* Decrement the loop counter */
80     blkCnt--;
81   }
82
83   /* If the blockSize is not a multiple of 4, compute any remaining output samples here.   
84    ** No loop unrolling is used. */
85   blkCnt = blockSize % 0x4u;
86
87 #else
88
89   /* Run the below code for Cortex-M0 */
90
91   /* Loop over blockSize number of values */
92   blkCnt = blockSize;
93
94 #endif /* #ifndef ARM_MATH_CM0 */
95
96   while(blkCnt > 0u)
97   {
98     /* C = A */
99     /* Copy and then store the value in the destination buffer */
100     *pDst++ = *pSrc++;
101
102     /* Decrement the loop counter */
103     blkCnt--;
104   }
105 }
106
107 /**   
108  * @} end of BasicCopy group   
109  */