1/*
2 * File: rtGetInf.c
3 *
4 * Code generated for Simulink model 'PMSM_Controller'.
5 *
6 * Model version : 1.885
7 * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
8 * C/C++ source code generated on : Sat Jan 8 15:44:11 2022
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: ARM Compatible->ARM Cortex-M
12 * Code generation objectives:
13 * 1. Execution efficiency
14 * 2. RAM efficiency
15 * Validation result: Not run
16 */
17
18/*
19 * Abstract:
20 * Function to initialize non-finite, Inf
21 */
22#include "rtGetInf.h"
23#define NumBitsPerChar 8U
24
25/*
26 * Initialize rtInf needed by the generated code.
27 * Inf is initialized as non-signaling. Assumes IEEE.
28 */
29real_T rtGetInf(void)
30{
31 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
32 real_T inf = 0.0;
33 if (bitsPerReal == 32U) {
34 inf = rtGetInfF();
35 } else {
36 union {
37 LittleEndianIEEEDouble bitVal;
38 real_T fltVal;
39 } tmpVal;
40
41 tmpVal.bitVal.words.wordH = 0x7FF00000U;
42 tmpVal.bitVal.words.wordL = 0x00000000U;
43 inf = tmpVal.fltVal;
44 }
45
46 return inf;
47}
48
49/*
50 * Initialize rtInfF needed by the generated code.
51 * Inf is initialized as non-signaling. Assumes IEEE.
52 */
53real32_T rtGetInfF(void)
54{
55 IEEESingle infF;
56 infF.wordL.wordLuint = 0x7F800000U;
57 return infF.wordL.wordLreal;
58}
59
60/*
61 * Initialize rtMinusInf needed by the generated code.
62 * Inf is initialized as non-signaling. Assumes IEEE.
63 */
64real_T rtGetMinusInf(void)
65{
66 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
67 real_T minf = 0.0;
68 if (bitsPerReal == 32U) {
69 minf = rtGetMinusInfF();
70 } else {
71 union {
72 LittleEndianIEEEDouble bitVal;
73 real_T fltVal;
74 } tmpVal;
75
76 tmpVal.bitVal.words.wordH = 0xFFF00000U;
77 tmpVal.bitVal.words.wordL = 0x00000000U;
78 minf = tmpVal.fltVal;
79 }
80
81 return minf;
82}
83
84/*
85 * Initialize rtMinusInfF needed by the generated code.
86 * Inf is initialized as non-signaling. Assumes IEEE.
87 */
88real32_T rtGetMinusInfF(void)
89{
90 IEEESingle minfF;
91 minfF.wordL.wordLuint = 0xFF800000U;
92 return minfF.wordL.wordLreal;
93}
94
95/*
96 * File trailer for generated code.
97 *
98 * [EOF]
99 */
100