stage4/generate_cc/types.h
changeset 1 5d893a68be6e
equal deleted inserted replaced
0:fb772792efd1 1:5d893a68be6e
       
     1 /*
       
     2  * (c) 2000 Jiri Baum
       
     3  *          Mario de Sousa
       
     4  *
       
     5  * Offered to the public under the terms of the GNU General Public License
       
     6  * as published by the Free Software Foundation; either version 2 of the
       
     7  * License, or (at your option) any later version.
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful, but
       
    10  * WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
       
    12  * Public License for more details.
       
    13  *
       
    14  * This code is made available on the understanding that it will not be
       
    15  * used in safety-critical situations without a full and competent review.
       
    16  */
       
    17 
       
    18 
       
    19 #ifndef __PLC_TYPES_H
       
    20 #define __PLC_TYPES_H
       
    21 
       
    22 #include <limits.h>
       
    23 #include <float.h>   /* some limits related to floats are located here (?) */
       
    24 
       
    25 
       
    26 /*
       
    27  * This will need to be conditional on the arquitecture or something.
       
    28  * Anyone know where we can snarf the relevant magic easily?
       
    29  */
       
    30 typedef double                 f64; /* 64-bit floating point   */
       
    31 typedef float                  f32; /* 32-bit floating point   */
       
    32 
       
    33 typedef unsigned long long int u64; /* 64-bit unsigned integer */
       
    34 typedef long long int          i64; /* 64-bit signed integer   */
       
    35 typedef unsigned int           u32; /* 32-bit unsigned integer */
       
    36 typedef int                    i32; /* 32-bit signed integer   */
       
    37 typedef unsigned short int     u16; /* 16-bit unsigned integer */
       
    38 typedef short int              i16; /* 16-bit signed integer   */
       
    39 typedef unsigned char          u8;  /*  8-bit unsigned integer */
       
    40 typedef signed char            i8;  /*  8-bit signed integer   */
       
    41 
       
    42 /* some platforms seem to be missing <float.h> with the definition of FLT_MAX */
       
    43 #ifndef FLT_MAX
       
    44   /* this is the minimum value guaranteed by ANSI C++           */
       
    45   /* does anybody know the minimum value guaranteed for ANSI C ? */
       
    46 #define FLT_MAX 1E+37
       
    47 #endif
       
    48 #ifndef FLT_MIN
       
    49   /* this is the minimum value guaranteed by ANSI C++           */
       
    50   /* does anybody know the minimum value guaranteed for ANSI C ? */
       
    51 #define FLT_MIN 1E-37
       
    52 #endif
       
    53 
       
    54 #define f32_MAX FLT_MAX
       
    55 #define f32_MIN FLT_MIN
       
    56 
       
    57 #define u32_MAX UINT_MAX
       
    58 #define u32_MIN 0
       
    59 #define i32_MAX INT_MAX
       
    60 #define i32_MIN INT_MIN
       
    61 
       
    62 #define u16_MAX USHRT_MAX
       
    63 #define u16_MIN 0
       
    64 #define i16_MAX SHRT_MAX
       
    65 #define i16_MIN SHRT_MIN
       
    66 
       
    67 #define u8_MAX UCHAR_MAX
       
    68 #define u8_MIN 0
       
    69 #define i8_MAX SCHAR_MAX
       
    70 #define i8_MIN SCHAR_MIN
       
    71 
       
    72 #endif /* __PLC_TYPES_H */
       
    73