rtGetInf.cpp 2.2 KB

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