- Main Page
- Modules
- Data Structures
- Files
- Examples

- File List
- Globals

# arm_min_f32.c

Go to the documentation of this file.

    00001 /* ----------------------------------------------------------------------
    00002 * Copyright (C) 2010 ARM Limited. All rights reserved.
    00003 *
    00004 * $Date:        15. July 2011
    00005 * $Revision:    V1.0.10
    00006 *
    00007 * Project:      CMSIS DSP Library
    00008 * Title:        arm_min_f32.c
    00009 *
    00010 * Description:  Minimum value of a floating-point vector.
    00011 *
    00012 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
    00013 *
    00014 * Version 1.0.10 2011/7/15
    00015 *    Big Endian support added and Merged M0 and M3/M4 Source code.
    00016 *
    00017 * Version 1.0.3 2010/11/29
    00018 *    Re-organized the CMSIS folders and updated documentation.
    00019 *
    00020 * Version 1.0.2 2010/11/11
    00021 *    Documentation updated.
    00022 *
    00023 * Version 1.0.1 2010/10/05
    00024 *    Production release and review comments incorporated.
    00025 *
    00026 * Version 1.0.0 2010/09/20
    00027 *    Production release and review comments incorporated.
    00028 * ---------------------------------------------------------------------------- */
    00029
    00030 #include "arm_math.h"
    00031
    00060 void arm_min_f32(
    00061   float32_t * pSrc,
    00062   uint32_t blockSize,
    00063   float32_t * pResult,
    00064   uint32_t * pIndex)
    00065 {
    00066   float32_t minVal, out;                         /* Temporary variables to store the output value. */
    00067   uint32_t blkCnt, outIndex;                     /* loop counter */
    00068
    00069   /* Initialise the index value to zero. */
    00070   outIndex = 0u;
    00071   /* Load first input value that act as reference value for comparision */
    00072   out = *pSrc++;
    00073
    00074 #ifndef ARM_MATH_CM0
    00075
    00076   /* Run the below code for Cortex-M4 and Cortex-M3 */
    00077
    00078
    00079   /* Loop over blockSize number of values */
    00080   blkCnt = (blockSize - 1u);
    00081
    00082   do
    00083   {
    00084     /* Initialize minVal to the next consecutive values one by one */
    00085     minVal = *pSrc++;
    00086
    00087     /* compare for the minimum value */
    00088     if(out > minVal)
    00089     {
    00090       /* Update the minimum value and it's index */
    00091       out = minVal;
    00092       outIndex = blockSize - blkCnt;
    00093     }
    00094
    00095     blkCnt--;
    00096
    00097   } while(blkCnt > 0u);
    00098
    00099 #else
    00100
    00101   /* Run the below code for Cortex-M0 */
    00102
    00103   /* Loop over blockSize - 1 number of values */
    00104   blkCnt = (blockSize - 1u);
    00105
    00106   while(blkCnt > 0u)
    00107   {
    00108     /* Initialize minVal to the next consecutive values one by one */
    00109     minVal = *pSrc++;
    00110
    00111     /* compare for the minimum value */
    00112     if(out > minVal)
    00113     {
    00114       /* Update the minimum value and it's index */
    00115       out = minVal;
    00116       outIndex = blockSize - blkCnt;
    00117     }
    00118     /* Decrement the loop counter */
    00119     blkCnt--;
    00120
    00121   }
    00122
    00123 #endif /* #ifndef ARM_MATH_CM0 */
    00124
    00125
    00126   /* Store the minimum value and it's index into destination pointers */
    00127   *pResult = out;
    00128   *pIndex = outIndex;
    00129 }
    00130

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines