/ Drivers / CMSIS / DSP / Source / SupportFunctions / arm_sort_f32.c
arm_sort_f32.c
 1  /* ----------------------------------------------------------------------
 2   * Project:      CMSIS DSP Library
 3   * Title:        arm_sort_f32.c
 4   * Description:  Floating point sort
 5   *
 6   * $Date:        23 April 2021
 7   * $Revision:    V1.9.0
 8   *
 9   * Target Processor: Cortex-M and Cortex-A cores
10   * -------------------------------------------------------------------- */
11  /*
12   * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
13   *
14   * SPDX-License-Identifier: Apache-2.0
15   *
16   * Licensed under the Apache License, Version 2.0 (the License); you may
17   * not use this file except in compliance with the License.
18   * You may obtain a copy of the License at
19   *
20   * www.apache.org/licenses/LICENSE-2.0
21   *
22   * Unless required by applicable law or agreed to in writing, software
23   * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25   * See the License for the specific language governing permissions and
26   * limitations under the License.
27   */
28  
29  #include "arm_sorting.h"
30  
31  /**
32    @ingroup groupSupport
33   */
34  
35  /**
36    @addtogroup Sorting
37    @{
38   */
39  
40  
41  /**
42   * @brief Generic sorting function
43   *
44   * @param[in]  S          points to an instance of the sorting structure.
45   * @param[in]  pSrc       points to the block of input data.
46   * @param[out] pDst       points to the block of output data.
47   * @param[in]  blockSize  number of samples to process.
48   */
49  
50  void arm_sort_f32(
51    const arm_sort_instance_f32 * S, 
52          float32_t * pSrc, 
53          float32_t * pDst, 
54          uint32_t blockSize)
55  {
56      switch(S->alg)
57      {
58          case ARM_SORT_BITONIC:
59          arm_bitonic_sort_f32(S, pSrc, pDst, blockSize);
60          break;
61  
62          case ARM_SORT_BUBBLE:
63          arm_bubble_sort_f32(S, pSrc, pDst, blockSize);
64          break;
65  
66          case ARM_SORT_HEAP:
67          arm_heap_sort_f32(S, pSrc, pDst, blockSize);
68          break;
69  
70          case ARM_SORT_INSERTION:
71          arm_insertion_sort_f32(S, pSrc, pDst, blockSize);
72          break;
73  
74          case ARM_SORT_QUICK:
75          arm_quick_sort_f32(S, pSrc, pDst, blockSize);
76          break;
77  
78          case ARM_SORT_SELECTION:
79          arm_selection_sort_f32(S, pSrc, pDst, blockSize);
80          break;
81      }
82  }
83  
84  /**
85    @} end of Sorting group
86   */