rtGetInf.c
Go to the documentation of this file.
00001 /*
00002  * rtGetInf.c
00003  *
00004  * Embedded MATLAB Coder code generation for function 'autogen_ekf_propagation'
00005  *
00006  * C source code generated on: Wed Aug 24 18:34:48 2011
00007  *
00008  */
00009 
00010 /*
00011  * Abstract:
00012  *       Real-Time Workshop function to initialize non-finite, Inf and MinusInf
00013  */
00014 #include "rtGetInf.h"
00015 #define NumBitsPerChar  8U
00016 
00017 /* Function: rtGetInf ==================================================
00018  * Abstract:
00019  * Initialize rtInf needed by the generated code.
00020  * Inf is initialized as non-signaling. Assumes IEEE.
00021  */
00022 real_T rtGetInf(void)
00023 {
00024   size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
00025   real_T inf = 0.0;
00026   if (bitsPerReal == 32U) {
00027     inf = rtGetInfF();
00028   } else {
00029     uint16_T one = 1U;
00030     enum {
00031       LittleEndian,
00032       BigEndian
00033     } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
00034     switch (machByteOrder) {
00035      case LittleEndian:
00036       {
00037         union {
00038           LittleEndianIEEEDouble bitVal;
00039           real_T fltVal;
00040         } tmpVal;
00041 
00042         tmpVal.bitVal.words.wordH = 0x7FF00000U;
00043         tmpVal.bitVal.words.wordL = 0x00000000U;
00044         inf = tmpVal.fltVal;
00045         break;
00046       }
00047 
00048      case BigEndian:
00049       {
00050         union {
00051           BigEndianIEEEDouble bitVal;
00052           real_T fltVal;
00053         } tmpVal;
00054 
00055         tmpVal.bitVal.words.wordH = 0x7FF00000U;
00056         tmpVal.bitVal.words.wordL = 0x00000000U;
00057         inf = tmpVal.fltVal;
00058         break;
00059       }
00060     }
00061   }
00062 
00063   return inf;
00064 }
00065 
00066 /* Function: rtGetInfF ==================================================
00067  * Abstract:
00068  * Initialize rtInfF needed by the generated code.
00069  * Inf is initialized as non-signaling. Assumes IEEE.
00070  */
00071 real32_T rtGetInfF(void)
00072 {
00073   IEEESingle infF;
00074   infF.wordL.wordLuint = 0x7F800000U;
00075   return infF.wordL.wordLreal;
00076 }
00077 
00078 /* Function: rtGetMinusInf ==================================================
00079  * Abstract:
00080  * Initialize rtMinusInf needed by the generated code.
00081  * Inf is initialized as non-signaling. Assumes IEEE.
00082  */
00083 real_T rtGetMinusInf(void)
00084 {
00085   size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
00086   real_T minf = 0.0;
00087   if (bitsPerReal == 32U) {
00088     minf = rtGetMinusInfF();
00089   } else {
00090     uint16_T one = 1U;
00091     enum {
00092       LittleEndian,
00093       BigEndian
00094     } machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
00095     switch (machByteOrder) {
00096      case LittleEndian:
00097       {
00098         union {
00099           LittleEndianIEEEDouble bitVal;
00100           real_T fltVal;
00101         } tmpVal;
00102 
00103         tmpVal.bitVal.words.wordH = 0xFFF00000U;
00104         tmpVal.bitVal.words.wordL = 0x00000000U;
00105         minf = tmpVal.fltVal;
00106         break;
00107       }
00108 
00109      case BigEndian:
00110       {
00111         union {
00112           BigEndianIEEEDouble bitVal;
00113           real_T fltVal;
00114         } tmpVal;
00115 
00116         tmpVal.bitVal.words.wordH = 0xFFF00000U;
00117         tmpVal.bitVal.words.wordL = 0x00000000U;
00118         minf = tmpVal.fltVal;
00119         break;
00120       }
00121     }
00122   }
00123 
00124   return minf;
00125 }
00126 
00127 /* Function: rtGetMinusInfF ==================================================
00128  * Abstract:
00129  * Initialize rtMinusInfF needed by the generated code.
00130  * Inf is initialized as non-signaling. Assumes IEEE.
00131  */
00132 real32_T rtGetMinusInfF(void)
00133 {
00134   IEEESingle minfF;
00135   minfF.wordL.wordLuint = 0xFF800000U;
00136   return minfF.wordL.wordLreal;
00137 }
00138 
00139 /* End of Embedded MATLAB Coder code generation (rtGetInf.c) */


asctec_hl_firmware
Author(s): Markus Achtelik, Michael Achtelik, Stephan Weiss, Laurent Kneip
autogenerated on Tue Dec 17 2013 11:39:27