1/*
2 * File: rtGetInf.c
3 *
4 * Code generated for Simulink model 'EV3Control_sil_sil_ec'.
5 *
6 * Model version : 1.2
7 * Simulink Coder version : 9.0 (R2018b) 24-May-2018
8 * C/C++ source code generated on : Tue Oct 29 09:31:45 2019
9 */
10
11/*
12 * Abstract:
13 * Function to initialize non-finite, Inf
14 */
15#include "rtGetInf.h"
16#define NumBitsPerChar 8U
17
18/*
19 * Initialize rtInf needed by the generated code.
20 * Inf is initialized as non-signaling. Assumes IEEE.
21 */
22real_T rtGetInf(void)
23{
24 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
25 real_T inf = 0.0;
26 if (bitsPerReal == 32U) {
27 inf = rtGetInfF();
28 } else {
29 uint16_T one = 1U;
30 enum {
31 LittleEndian,
32 BigEndian
33 } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
34 switch (machByteOrder) {
35 case LittleEndian:
36 {
37 union {
38 LittleEndianIEEEDouble bitVal;
39 real_T fltVal;
40 } tmpVal;
41
42 tmpVal.bitVal.words.wordH = 0x7FF00000U;
43 tmpVal.bitVal.words.wordL = 0x00000000U;
44 inf = tmpVal.fltVal;
45 break;
46 }
47
48 case BigEndian:
49 {
50 union {
51 BigEndianIEEEDouble bitVal;
52 real_T fltVal;
53 } tmpVal;
54
55 tmpVal.bitVal.words.wordH = 0x7FF00000U;
56 tmpVal.bitVal.words.wordL = 0x00000000U;
57 inf = tmpVal.fltVal;
58 break;
59 }
60 }
61 }
62
63 return inf;
64}
65
66/*
67 * Initialize rtInfF needed by the generated code.
68 * Inf is initialized as non-signaling. Assumes IEEE.
69 */
70real32_T rtGetInfF(void)
71{
72 IEEESingle infF;
73 infF.wordL.wordLuint = 0x7F800000U;
74 return infF.wordL.wordLreal;
75}
76
77/*
78 * Initialize rtMinusInf needed by the generated code.
79 * Inf is initialized as non-signaling. Assumes IEEE.
80 */
81real_T rtGetMinusInf(void)
82{
83 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
84 real_T minf = 0.0;
85 if (bitsPerReal == 32U) {
86 minf = rtGetMinusInfF();
87 } else {
88 uint16_T one = 1U;
89 enum {
90 LittleEndian,
91 BigEndian
92 } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
93 switch (machByteOrder) {
94 case LittleEndian:
95 {
96 union {
97 LittleEndianIEEEDouble bitVal;
98 real_T fltVal;
99 } tmpVal;
100
101 tmpVal.bitVal.words.wordH = 0xFFF00000U;
102 tmpVal.bitVal.words.wordL = 0x00000000U;
103 minf = tmpVal.fltVal;
104 break;
105 }
106
107 case BigEndian:
108 {
109 union {
110 BigEndianIEEEDouble bitVal;
111 real_T fltVal;
112 } tmpVal;
113
114 tmpVal.bitVal.words.wordH = 0xFFF00000U;
115 tmpVal.bitVal.words.wordL = 0x00000000U;
116 minf = tmpVal.fltVal;
117 break;
118 }
119 }
120 }
121
122 return minf;
123}
124
125/*
126 * Initialize rtMinusInfF needed by the generated code.
127 * Inf is initialized as non-signaling. Assumes IEEE.
128 */
129real32_T rtGetMinusInfF(void)
130{
131 IEEESingle minfF;
132 minfF.wordL.wordLuint = 0xFF800000U;
133 return minfF.wordL.wordLreal;
134}
135
136/*
137 * File trailer for generated code.
138 *
139 * [EOF]
140 */
141