| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef GIT_CONFIG_H |
| 5 |
#define GIT_CONFIG_H |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#include <limits.h> |
| 36 |
|
| 37 |
#if CHAR_BIT != 8 |
| 38 |
#error "Git needs 8-bit bytes" |
| 39 |
#endif |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#if 0 |
| 44 |
|
| 45 |
#error "Git needs 32-bit pointers" |
| 46 |
#endif |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#if UCHAR_MAX==0xff |
| 51 |
typedef signed char git_sint8; |
| 52 |
typedef unsigned char git_uint8; |
| 53 |
#else |
| 54 |
#error "Can't find an 8-bit integer type" |
| 55 |
#endif |
| 56 |
|
| 57 |
#if SHRT_MAX==0x7fff |
| 58 |
typedef signed short git_sint16; |
| 59 |
typedef unsigned short git_uint16; |
| 60 |
#elif INT_MAX==0x7fff |
| 61 |
typedef signed int git_sint16; |
| 62 |
typedef unsigned int git_uint16; |
| 63 |
#else |
| 64 |
#error "Can't find a 16-bit integer type" |
| 65 |
#endif |
| 66 |
|
| 67 |
#if INT_MAX==0x7fffffff |
| 68 |
typedef signed int git_sint32; |
| 69 |
typedef unsigned int git_uint32; |
| 70 |
#elif LONG_MAX==0x7fffffff |
| 71 |
typedef signed long git_sint32; |
| 72 |
typedef unsigned long git_uint32; |
| 73 |
#else |
| 74 |
#error "Can't find a 32-bit integer type" |
| 75 |
#endif |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
#ifdef USE_INLINE |
| 80 |
#define GIT_INLINE static inline |
| 81 |
#else |
| 82 |
#define GIT_INLINE static |
| 83 |
#endif |
| 84 |
|
| 85 |
typedef float git_float; |
| 86 |
typedef double git_double; |
| 87 |
|
| 88 |
|
| 89 |
#if defined(__GNUC__) |
| 90 |
|
| 91 |
# define maybe_unused __attribute__((__unused__)) |
| 92 |
# define git_noreturn __attribute__((__noreturn__)) |
| 93 |
#elif defined(_MSC_VER) |
| 94 |
|
| 95 |
# define maybe_unused |
| 96 |
# define git_noreturn __declspec(noreturn) |
| 97 |
#else |
| 98 |
# define maybe_unused |
| 99 |
# define git_noreturn |
| 100 |
#endif |
| 101 |
|
| 102 |
#endif |