Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / support / lt_types.h @ 3539

History | View | Annotate | Download (4.64 KB)

1
/* $Id: lt_types.h 3539 2006-01-09 12:23:20Z nacho $ */
2
/* //////////////////////////////////////////////////////////////////////////
3
//                                                                         //
4
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue,   //
5
// Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
6
// prohibited.  Access to and use of this code is permitted only under     //
7
// license from LizardTech, Inc.  Portions of the code are protected by    //
8
// US and foreign patents and other filings. All Rights Reserved.          //
9
//                                                                         //
10
////////////////////////////////////////////////////////////////////////// */
11
/* PUBLIC */
12

    
13
/**      
14
 * @file
15
 *
16
 * Declaration of standard types and limits in a C-interface.
17
 * 
18
 * @note This file is C-callable.
19
 */
20

    
21

    
22
#ifndef LT_TYPES_H
23
#define LT_TYPES_H
24

    
25
#include <limits.h>
26
#include <float.h>
27

    
28
#include "lt_platform.h"
29

    
30

    
31
#if defined(LT_COMPILER_MS)
32
   #pragma warning(push,4) 
33
#endif
34

    
35
/**
36
 * @name Fundamental types
37
 *
38
 * We provide typdefs for all the basic C datatypes.
39
 *
40
 * @note 80 and 128-bit floats are inherently unportable, so we do not use them.
41
 */
42
/*@{*/
43
/** signed 8-bit integer */
44
typedef signed char     lt_int8;
45
/** unsigned 8-bit integer */
46
typedef unsigned char   lt_uint8;
47
/** signed 16-bit integer */
48
typedef signed short    lt_int16;
49
/** unsigned 16-bit integer */
50
typedef unsigned short  lt_uint16;
51
/** signed 32-bit integer */
52
typedef signed int      lt_int32;
53
/** unsigned 32-bit integer */
54
typedef unsigned int    lt_uint32;
55
/** 32-bit floating point (\b DEPRECATED) */
56
typedef float           lt_float32;
57
/** 64-bit floating point (\b DEPRECATED) */
58
typedef double          lt_float64;
59

    
60
#if defined(LT_COMPILER_MS)
61
   /** signed 64-bit integer */
62
   typedef signed __int64     lt_int64;
63
   /** unsigned 64-bit integer */
64
   typedef unsigned __int64   lt_uint64;
65
#elif defined ( LT_COMPILER_GNU ) || \
66
      defined ( LT_COMPILER_SUN )
67
   /** signed 64-bit integer */
68
   typedef long long int              lt_int64;
69
   /** unsigned 64-bit integer */
70
   typedef unsigned long long int     lt_uint64;
71
#else
72
   #error NOT YET PORTED TO TARGET COMPILER
73
#endif
74
/*@}*/
75

    
76

    
77
#ifndef DOXYGEN_EXCLUDE
78

    
79
#define LT_CHAR_MAX ((char)CHAR_MAX) 
80
#define LT_CHAR_MIN ((char)CHAR_MIN) 
81
#define LT_SCHAR_MAX ((signed char)SCHAR_MAX) 
82
#define LT_SCHAR_MIN ((signed char)SCHAR_MIN) 
83
#define LT_UCHAR_MAX ((unsigned char)UCHAR_MAX) 
84

    
85
#define LT_SHRT_MAX ((short int)SHRT_MAX) 
86
#define LT_SHRT_MIN ((short int)SHRT_MIN) 
87
#define LT_USHRT_MAX ((unsigned short int)USHRT_MAX) 
88

    
89
#define LT_INT_MAX ((int)INT_MAX) 
90
#define LT_INT_MIN ((int)INT_MIN) 
91
#define LT_UINT_MAX ((unsigned int)UINT_MAX) 
92

    
93
#define LT_LONG_MAX ((long int)LONG_MAX) 
94
#define LT_LONG_MIN ((long int)LONG_MIN) 
95
#define LT_ULONG_MAX ((unsigned long int)ULONG_MAX) 
96

    
97
#define LT_FLT_MIN ((float)FLT_MIN)
98
#define LT_FLT_MAX ((float)FLT_MAX)
99
#define LT_FLOAT_MIN (LT_FLT_MIN)
100
#define LT_FLOAT_MAX (LT_FLT_MAX)
101

    
102
#define LT_DBL_MIN ((double)DBL_MIN)
103
#define LT_DBL_MAX ((double)DBL_MAX)
104
#define LT_DOUBLE_MIN (LT_DBL_MIN)
105
#define LT_DOUBLE_MAX (LT_DBL_MAX)
106

    
107
#define LT_INT8_MAX      ((lt_int8)127)                     /*  2^7 - 1  */
108
#define LT_INT8_MIN      ((lt_int8)(-LT_INT8_MAX - 1))      /*  -2^7     */
109
#define LT_UINT8_MAX     ((lt_uint8)255U)                   /*  2^8 - 1  */
110
#define LT_UINT8_MIN     (0)
111
#define LT_INT16_MAX     ((lt_int16)32767)                  /*  2^15 - 1 */
112
#define LT_INT16_MIN     ((lt_int16)-LT_INT16_MAX - 1)      /*  -2^15    */
113
#define LT_UINT16_MAX    ((lt_uint16)65535U)                /*  2^16 - 1 */
114
#define LT_UINT16_MIN    (0)
115
#define LT_INT32_MAX     ((lt_int32)2147483647)             /* 2^31 - 1 */
116
#define LT_INT32_MIN     ((lt_int32)(-LT_INT32_MAX - 1))    /* -2^31    */
117
#define LT_UINT32_MAX    ((lt_uint32)4294967295U)           /* 2^32 - 1 */
118
#define LT_UINT32_MIN    (0)
119
#define LT_INT64_MIN     ((lt_int64)-LT_INT64_MAX - 1)      /* -2^63    */
120
#define LT_UINT64_MIN    (0)
121

    
122
// GNU wants these constants suffixed, windows does not
123
#if defined(LT_COMPILER_GNU) || \
124
    defined(LT_COMPILER_SUN)
125
        #define LT_INT64_MAX     ((lt_int64)9223372036854775807LL)    /* 2^63 - 1 */
126
        #define LT_UINT64_MAX    ((lt_uint64)18446744073709551615ULL)  /* 2^64 - 1 */
127
#elif defined(LT_COMPILER_MS)
128
        #define LT_INT64_MAX     ((lt_int64)9223372036854775807)    /* 2^63 - 1 */
129
        #define LT_UINT64_MAX    ((lt_uint64)18446744073709551615)  /* 2^64 - 1 */
130
#else
131
   #error NOT YET PORTED TO TARGET COMPILER
132
#endif
133

    
134
#endif /* DOXYGEN_EXCLUDE */
135

    
136

    
137
/** (\b DEPRECATED) */
138
typedef char lt_utf8;
139
#define LT_UTF8STR(str) ((lt_utf8 *)(str))
140

    
141

    
142
#if defined(LT_COMPILER_MS)
143
   #pragma warning(pop) 
144
#endif
145

    
146
#endif /* LT_TYPES_H */