#### File: rtGetNaN.c
        1   /*
        2    * File: rtGetNaN.c
        3    *
        4    * MATLAB Coder version            : 3.4
        5    * C/C++ source code generated on  : 18-Feb-2019 15:40:18
        6    */
        7
        8   /*
        9    * Abstract:
       10    *       MATLAB for code generation function to initialize non-finite, NaN
       11    */
       12   #include "rtGetNaN.h"
       13   #define NumBitsPerChar                 8U
       14
       15   /* Function: rtGetNaN ==================================================
       16    * Abstract:
       17    * Initialize rtNaN needed by the generated code.
       18    * NaN is initialized as non-signaling. Assumes IEEE.
       19    */
       20   real_T rtGetNaN(void)
       21   {
       22     real_T nan = 0.0;
       23     uint16_T one = 1U;
       24     enum {
       25       LittleEndian,
       26       BigEndian
       27     } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
       28     switch (machByteOrder) {
       29      case LittleEndian:
       30       {
       31         union {
       32           LittleEndianIEEEDouble bitVal;
       33           real_T fltVal;
       34         } tmpVal;
       35
       36         tmpVal.bitVal.words.wordH = 0xFFF80000U;
       37         tmpVal.bitVal.words.wordL = 0x00000000U;
       38         nan = tmpVal.fltVal;
       39         break;
       40       }
       41
       42      case BigEndian:
       43       {
       44         union {
       45           BigEndianIEEEDouble bitVal;
       46           real_T fltVal;
       47         } tmpVal;
       48
       49         tmpVal.bitVal.words.wordH = 0x7FFFFFFFU;
       50         tmpVal.bitVal.words.wordL = 0xFFFFFFFFU;
       51         nan = tmpVal.fltVal;
       52         break;
       53       }
       54     }
       55
       56     return nan;
       57   }
       58
       59   /* Function: rtGetNaNF ==================================================
       60    * Abstract:
       61    * Initialize rtNaNF needed by the generated code.
       62    * NaN is initialized as non-signaling. Assumes IEEE.
       63    */
       64   real32_T rtGetNaNF(void)
       65   {
       66     IEEESingle nanF = { { 0 } };
       67
       68     uint16_T one = 1U;
       69     enum {
       70       LittleEndian,
       71       BigEndian
       72     } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
       73     switch (machByteOrder) {
       74      case LittleEndian:
       75       {
       76         nanF.wordL.wordLuint = 0xFFC00000U;
       77         break;
       78       }
       79
       80      case BigEndian:
       81       {
       82         nanF.wordL.wordLuint = 0x7FFFFFFFU;
       83         break;
       84       }
       85     }
       86
       87     return nanF.wordL.wordLreal;
       88   }
       89
       90   /*
       91    * File trailer for rtGetNaN.c
       92    *
       93    * [EOF]
       94    */
       95