ptypes.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 3 -*-
00002  *
00003  * Copyright (c) 2013, GREYC.
00004  * All rights reserved
00005  *
00006  * You may use this file under the terms of the BSD license as follows:
00007  *
00008  * "Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are
00010  * met:
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above copyright
00014  *     notice, this list of conditions and the following disclaimer in
00015  *     the documentation and/or other materials provided with the
00016  *     distribution.
00017  *   * Neither the name of the GREYC, nor the name of its
00018  *     contributors may be used to endorse or promote products
00019  *     derived from this software without specific prior written
00020  *     permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00033  *
00034  *
00035  * For more information, refer to:
00036  * https://clouard.users.greyc.fr/Pandore
00037  */
00038 
00050 #ifndef __PPTYPESH__
00051 #define __PPTYPESH__
00052 
00053 namespace pandore {
00054 
00055 #ifdef _MSC_VER
00056    typedef __int8       int8_t;
00057    typedef unsigned __int8      uint8_t;
00058    typedef __int16      int16_t;
00059    typedef unsigned __int16     uint16_t;
00060    typedef __int32      int32_t;
00061    typedef unsigned __int32     uint32_t;
00062    typedef __int64      int64_t;
00063    typedef unsigned __int64     uint64_t;
00064 #else
00065    #include <stdint.h>
00066 #endif
00067 
00068 /*
00069  * The basic scalar types.
00070  *
00071  * DO NOT DELETE the following inline comments (BASE and BASE IMAGE)!
00072  * (`BASE' is a flag for the preprocessor macro `forallbase')
00073  * (`BASE IMAGE' is a flag for the preprocessor macro `forallbaseimage')
00074  */
00075 typedef char            Char;   // BASE
00076 typedef unsigned char   Uchar;  // BASE IMAGE
00077 typedef int16_t         Short;  // BASE
00078 typedef uint16_t        Ushort; // BASE
00079 typedef int32_t         Long;   // BASE IMAGE
00080 typedef uint32_t        Ulong;  // BASE
00081 typedef int64_t         Llong;  // BASE
00082 typedef uint64_t        Ullong; // BASE
00083 typedef float           Float;  // BASE IMAGE
00084 typedef double          Double; // BASE
00085 
00086 #define POINTERSIZE     4
00087 
00088 #ifndef FLT_EPSILON
00089 #define FLT_EPSILON     1.1920928955078125000000E-07F
00090 #endif
00091 #ifndef DBL_EPSILON
00092 #define DBL_EPSILON     2.2204460492503130808473E-16
00093 #endif
00094 
00095 /*
00096  * Definition of max and min values for each types.
00097  */
00098 
00099 #ifndef MININT1
00100 #define MININT1 (-128)          /* min value of a "int 1 byte" */
00101 #endif
00102 
00103 #ifndef MAXINT1
00104 #define MAXINT1 127             /* max value of a "int 1 byte" */
00105 #endif
00106 
00107 #ifndef MAXUINT1
00108 #define MAXUINT1 255            /* max value of an "unsigned int 1 byte" */
00109 #endif
00110 
00111 #ifndef MININT2
00112 #define MININT2 (-32768)        /* min value of a "int 2 bytes" */
00113 #endif
00114 
00115 #ifndef MAXINT2
00116 #define MAXINT2 32767           /* max value of a "int 2 bytes" */
00117 #endif
00118 
00119 #ifndef MAXUINT2
00120 #define MAXUINT2 65535          /* max value of "unsigned int 2 bytes" */
00121 #endif
00122 
00123 #ifndef MININT4
00124 #define MININT4 (-2147483647-1) /* min value of an "int 4 bytes" */
00125 #endif
00126 
00127 #ifndef MAXINT4
00128 #define MAXINT4 2147483647      /* max value of an "int 4 bytes" */
00129 #endif
00130 
00131 #ifndef MAXUINT4
00132 #define MAXUINT4 4294967295U    /* max value of an "unsigned int 4 bytes" */
00133 #endif
00134 
00135 #ifndef MINFLOAT4
00136 #define MINFLOAT4 1.175494351E-38F /* max precision between 2 floats */
00137 #endif
00138 
00139 #ifndef MAXFLOAT4
00140 #define MAXFLOAT4 3.402823466E+38F
00141 #endif
00142 
00143 #ifndef MINFLOAT8
00144 #define MINFLOAT8 2.2250738585072014E-308 /* max precision between 2 floats */
00145 #endif
00146 
00147 #ifndef MAXFLOAT8
00148 #define MAXFLOAT8 1.7976931348623157E+308
00149 #endif
00150 
00151 // Kept for compatibility
00152 #ifndef MINCHAR
00153 #define MINCHAR (-128)          /* min value of a "signed char" */
00154 #endif
00155 
00156 #ifndef MAXCHAR
00157 #define MAXCHAR 127             /* max value of a "signed char" */
00158 #endif
00159 
00160 #ifndef MAXUCHAR
00161 #define MAXUCHAR 255            /* max value of an "unsigned char" */
00162 #endif
00163 
00164 
00165 #ifndef MINSHORT
00166 #define MINSHORT (-32768)       /* min value of a "short int" */
00167 #endif
00168 
00169 #ifndef MAXSHORT
00170 #define MAXSHORT 32767          /* max value of a "short int" */
00171 #endif
00172 
00173 #ifndef MAXUSHORT
00174 #define MAXUSHORT 65535         /* max value of "unsigned short int" */
00175 #endif
00176 
00177 
00178 #ifndef MINLONG
00179 #define MINLONG (-2147483647-1) /* min value of an "int 4 bytes" */
00180 #endif
00181 
00182 #ifndef MAXLONG
00183 #define MAXLONG 2147483647      /* max value of an "int 4 bytes" */
00184 #endif
00185 
00186 #ifndef MAXULONG
00187 #define MAXULONG 4294967295U    /* max value of an "unsigned long int" */
00188 #endif
00189 
00190 #ifndef MINFLOAT
00191 #define MINFLOAT 1.175494351E-38F
00192 #endif
00193 #ifndef MAXFLOAT
00194 #define MAXFLOAT 3.402823466E+38F
00195 #endif
00196 #ifndef MINDOUBLE
00197 #define MINDOUBLE 2.2250738585072014E-308
00198 #endif
00199 
00200 #ifndef MAXDOUBLE
00201 #define MAXDOUBLE 1.7976931348623157E+308
00202 #endif
00203 
00204 #ifndef MAXLLONG
00205 #define MAXLLONG 9223372036854775807LL
00206 #endif
00207 
00208 #ifndef MAXULLONG
00209 #define MAXULLONG 18446744073709551615ULL
00210 #endif
00211 
00212 } //End of pandore:: namespace
00213 
00214 #endif

The Pantheon project
Image Team GREYC Laboratory
UMR CNRS 6072 - ENSICAEN - University of Caen, France
This page was last modified on