1 /* 2 * Copyright 2008-2013 NVIDIA Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC) || (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_CLANG) 20 #include <stdint.h> 21 #endif 22 23 namespace thrust 24 { 25 namespace detail 26 { 27 28 #if (THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC) 29 30 #if (_MSC_VER < 1300) 31 typedef signed char int8_t; 32 typedef signed short int16_t; 33 typedef signed int int32_t; 34 typedef unsigned char uint8_t; 35 typedef unsigned short uint16_t; 36 typedef unsigned int uint32_t; 37 #else 38 typedef signed __int8 int8_t; 39 typedef signed __int16 int16_t; 40 typedef signed __int32 int32_t; 41 typedef unsigned __int8 uint8_t; 42 typedef unsigned __int16 uint16_t; 43 typedef unsigned __int32 uint32_t; 44 #endif 45 typedef signed __int64 int64_t; 46 typedef unsigned __int64 uint64_t; 47 48 #else 49 50 typedef ::int8_t int8_t; 51 typedef ::int16_t int16_t; 52 typedef ::int32_t int32_t; 53 typedef ::int64_t int64_t; 54 typedef ::uint8_t uint8_t; 55 typedef ::uint16_t uint16_t; 56 typedef ::uint32_t uint32_t; 57 typedef ::uint64_t uint64_t; 58 59 #endif 60 61 62 // an oracle to tell us how to define intptr_t 63 template<int word_size = sizeof(void*)> struct divine_intptr_t; 64 template<int word_size = sizeof(void*)> struct divine_uintptr_t; 65 66 // 32b platforms 67 template<> struct divine_intptr_t<4> { typedef thrust::detail::int32_t type; }; 68 template<> struct divine_uintptr_t<4> { typedef thrust::detail::uint32_t type; }; 69 70 // 64b platforms 71 template<> struct divine_intptr_t<8> { typedef thrust::detail::int64_t type; }; 72 template<> struct divine_uintptr_t<8> { typedef thrust::detail::uint64_t type; }; 73 74 typedef divine_intptr_t<>::type intptr_t; 75 typedef divine_uintptr_t<>::type uintptr_t; 76 77 } // end detail 78 } // end thrust 79 80