1 // Copyright 2016 Google Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 17 #ifndef UTIL_PORT_H_ 18 #define UTIL_PORT_H_ 19 20 #include <stdarg.h> 21 22 #if defined(_MSC_VER) 23 #define GG_LONGLONG(x) x##I64 24 #define GG_ULONGLONG(x) x##UI64 25 #else 26 #define GG_LONGLONG(x) x##LL 27 #define GG_ULONGLONG(x) x##ULL 28 #endif 29 30 // Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including <stdint.h> 31 // to get the INTn_C and UINTn_C macros for integer constants. It's difficult 32 // to guarantee any specific ordering of header includes, so it's difficult to 33 // guarantee that the INTn_C macros can be defined by including <stdint.h> at 34 // any specific point. Provide GG_INTn_C macros instead. 35 36 #define GG_INT8_C(x) (x) 37 #define GG_INT16_C(x) (x) 38 #define GG_INT32_C(x) (x) 39 #define GG_INT64_C(x) GG_LONGLONG(x) 40 41 #define GG_UINT8_C(x) (x ## U) 42 #define GG_UINT16_C(x) (x ## U) 43 #define GG_UINT32_C(x) (x ## U) 44 #define GG_UINT64_C(x) GG_ULONGLONG(x) 45 46 // Define an OS-neutral wrapper for shared library entry points 47 #if defined(_WIN32) 48 #define API_CALL __stdcall 49 #else 50 #define API_CALL 51 #endif 52 53 #endif // UTIL_PORT_H_ 54