arm_f64_to_float.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_f64_to_float.c
  4. * Description: Converts the elements of the floating-point 64 bit vector to floating-point vector
  5. *
  6. * $Date: 18 August 2022
  7. * $Revision: V1.0.0
  8. *
  9. * Target Processor: Cortex-M and Cortex-A cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2022 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. #include "dsp/support_functions.h"
  29. /**
  30. @ingroup groupSupport
  31. */
  32. /**
  33. @addtogroup f64_to_x
  34. @{
  35. */
  36. /**
  37. @brief Converts the elements of the f64 vector to f32 vector.
  38. @param[in] pSrc points to the f64 input vector
  39. @param[out] pDst points to the f32 output vector
  40. @param[in] blockSize number of samples in each vector
  41. */
  42. void arm_f64_to_float(
  43. const float64_t * pSrc,
  44. float32_t * pDst,
  45. uint32_t blockSize)
  46. {
  47. const float64_t *pIn = pSrc; /* Src pointer */
  48. uint32_t blkCnt; /* loop counter */
  49. /*
  50. * Loop over blockSize number of values
  51. */
  52. blkCnt = blockSize;
  53. while (blkCnt > 0U)
  54. {
  55. *pDst++ = (float32_t) * pIn++;
  56. /*
  57. * Decrement the loop counter
  58. */
  59. blkCnt--;
  60. }
  61. }
  62. /**
  63. @} end of f64_to_x group
  64. */