00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2011 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 15. December 2011 00005 * $Revision: V2.0.0 00006 * 00007 * Project: Cortex-R DSP Library 00008 * Title: arm_fill_q31.c 00009 * 00010 * Description: Fills a constant value into a Q31 vector. 00011 * 00012 * Target Processor: Cortex-R4/R5 00013 * 00014 * Version 1.0.0 2011/03/08 00015 * Alpha release. 00016 * 00017 * Version 1.0.1 2011/09/30 00018 * Beta release. 00019 * 00020 * Version 2.0.0 2011/12/15 00021 * Final release. 00022 * 00023 * -------------------------------------------------------------------- */ 00024 #include "arm_math.h" 00025 00044 void arm_fill_q31( 00045 q31_t value, 00046 q31_t * pDst, 00047 uint32_t blockSize) 00048 { 00049 uint32_t blkCnt; /* loop counter */ 00050 q31_t value1 = value; 00051 q31_t value2 = value; 00052 q31_t value3 = value; 00053 q31_t value4 = value; 00054 00055 00056 /*loop Unrolling */ 00057 blkCnt = blockSize >> 3u; 00058 00059 /* First part of the processing with loop unrolling. Compute 8 outputs at a time. 00060 ** a second loop below computes the remaining 1 to 7 samples. */ 00061 while(blkCnt > 0u) 00062 { 00063 /* C = value */ 00064 /* Fill the value in the destination buffer */ 00065 pDst[0] = value1; 00066 pDst[1] = value2; 00067 pDst[2] = value3; 00068 pDst[3] = value4; 00069 pDst[4] = value1; 00070 pDst[5] = value2; 00071 pDst[6] = value3; 00072 pDst[7] = value4; 00073 pDst += 8u; 00074 00075 /* Decrement the loop counter */ 00076 blkCnt--; 00077 } 00078 00079 /* If the blockSize is not a multiple of 8, compute any remaining output samples here. 00080 ** No loop unrolling is used. */ 00081 blkCnt = blockSize % 0x8u; 00082 00083 while(blkCnt > 0u) 00084 { 00085 /* C = value */ 00086 /* Fill the value in the destination buffer */ 00087 *pDst++ = value; 00088 00089 /* Decrement the loop counter */ 00090 blkCnt--; 00091 } 00092 } 00093