codekingpro/portable-devtools
114k
1/*
2 * Copyright 2009-2017 NVIDIA Corporation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of NVIDIA CORPORATION nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __cuda_stdint_h__
30#define __cuda_stdint_h__
31
32// Compiler-specific treatment for C99's stdint.h
33//
34// By default, this header will use the standard headers (so it
35// is your responsibility to make sure they are available), except
36// on MSVC before Visual Studio 2010, when they were not provided.
37// To support old MSVC, a few of the commonly-used definitions are
38// provided here. If more definitions are needed, add them here,
39// or replace these definitions with a complete implementation,
40// such as the ones available from Google, Boost, or MSVC10. You
41// can prevent the definition of any of these types (in order to
42// use your own) by #defining CU_STDINT_TYPES_ALREADY_DEFINED.
43
44#if !defined(CU_STDINT_TYPES_ALREADY_DEFINED)
45
46// In VS including stdint.h forces the C++ runtime dep - provide an opt-out
47// (CU_STDINT_VS_FORCE_NO_STDINT_H) for users that care (notably static
48// cudart).
49#if defined(_MSC_VER) && ((_MSC_VER < 1600) || defined(CU_STDINT_VS_FORCE_NO_STDINT_H))
50
51// These definitions can be used with MSVC 8 and 9,
52// which don't ship with stdint.h:
53
54typedef unsigned char uint8_t;
55
56typedef short int16_t;
57typedef unsigned short uint16_t;
58
59// To keep it consistent with all MSVC build. define those types
60// in the exact same way they are defined with the MSVC headers
61#if defined(_MSC_VER)
62typedef signed char int8_t;
63
64typedef int int32_t;
65typedef unsigned int uint32_t;
66
67typedef long long int64_t;
68typedef unsigned long long uint64_t;
69#else
70typedef char int8_t;
71
72typedef long int32_t;
73typedef unsigned long uint32_t;
74
75typedef __int64 int64_t;
76typedef unsigned __int64 uint64_t;
77#endif
78
79#elif defined(__DJGPP__)
80
81// These definitions can be used when compiling
82// C code with DJGPP, which only provides stdint.h
83// when compiling C++ code with TR1 enabled.
84
85typedef char int8_t;
86typedef unsigned char uint8_t;
87
88typedef short int16_t;
89typedef unsigned short uint16_t;
90
91typedef long int32_t;
92typedef unsigned long uint32_t;
93
94typedef long long int64_t;
95typedef unsigned long long uint64_t;
96
97#else
98
99// Use standard headers, as specified by C99 and C++ TR1.
100// Known to be provided by:
101// - gcc/glibc, supported by all versions of glibc
102// - djgpp, supported since 2001
103// - MSVC, supported by Visual Studio 2010 and later
104
105#include <stdint.h>
106
107#endif
108
109#endif // !defined(CU_STDINT_TYPES_ALREADY_DEFINED)
110
111
112#endif // file guard
113 