Aded CMSIS5 DSP and NN folder. Needs some work

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_copy_q31.c Source File

arm_copy_q31.c

00001 /* ----------------------------------------------------------------------
00002  * Project:      CMSIS DSP Library
00003  * Title:        arm_copy_q31.c
00004  * Description:  Copies the elements of a Q31 vector
00005  *
00006  * $Date:        27. January 2017
00007  * $Revision:    V.1.5.1
00008  *
00009  * Target Processor: Cortex-M cores
00010  * -------------------------------------------------------------------- */
00011 /*
00012  * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
00013  *
00014  * SPDX-License-Identifier: Apache-2.0
00015  *
00016  * Licensed under the Apache License, Version 2.0 (the License); you may
00017  * not use this file except in compliance with the License.
00018  * You may obtain a copy of the License at
00019  *
00020  * www.apache.org/licenses/LICENSE-2.0
00021  *
00022  * Unless required by applicable law or agreed to in writing, software
00023  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00024  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00025  * See the License for the specific language governing permissions and
00026  * limitations under the License.
00027  */
00028 
00029 #include "arm_math.h"
00030 
00031 /**
00032  * @ingroup groupSupport
00033  */
00034 
00035 /**
00036  * @addtogroup copy
00037  * @{
00038  */
00039 
00040 /**
00041  * @brief Copies the elements of a Q31 vector.
00042  * @param[in]       *pSrc points to input vector
00043  * @param[out]      *pDst points to output vector
00044  * @param[in]       blockSize length of the input vector
00045  * @return none.
00046  *
00047  */
00048 
00049 void arm_copy_q31(
00050   q31_t * pSrc,
00051   q31_t * pDst,
00052   uint32_t blockSize)
00053 {
00054   uint32_t blkCnt;                               /* loop counter */
00055 
00056 
00057 #if defined (ARM_MATH_DSP)
00058 
00059   /* Run the below code for Cortex-M4 and Cortex-M3 */
00060   q31_t in1, in2, in3, in4;
00061 
00062   /*loop Unrolling */
00063   blkCnt = blockSize >> 2U;
00064 
00065   /* First part of the processing with loop unrolling.  Compute 4 outputs at a time.
00066    ** a second loop below computes the remaining 1 to 3 samples. */
00067   while (blkCnt > 0U)
00068   {
00069     /* C = A */
00070     /* Copy and then store the values in the destination buffer */
00071     in1 = *pSrc++;
00072     in2 = *pSrc++;
00073     in3 = *pSrc++;
00074     in4 = *pSrc++;
00075 
00076     *pDst++ = in1;
00077     *pDst++ = in2;
00078     *pDst++ = in3;
00079     *pDst++ = in4;
00080 
00081     /* Decrement the loop counter */
00082     blkCnt--;
00083   }
00084 
00085   /* If the blockSize is not a multiple of 4, compute any remaining output samples here.
00086    ** No loop unrolling is used. */
00087   blkCnt = blockSize % 0x4U;
00088 
00089 #else
00090 
00091   /* Run the below code for Cortex-M0 */
00092 
00093   /* Loop over blockSize number of values */
00094   blkCnt = blockSize;
00095 
00096 #endif /* #if defined (ARM_MATH_DSP) */
00097 
00098   while (blkCnt > 0U)
00099   {
00100     /* C = A */
00101     /* Copy and then store the value in the destination buffer */
00102     *pDst++ = *pSrc++;
00103 
00104     /* Decrement the loop counter */
00105     blkCnt--;
00106   }
00107 }
00108 
00109 /**
00110  * @} end of BasicCopy group
00111  */
00112