2 Portable header to provide the 32 and 64 bits type.
4 Not a compatible replacement for <stdint.h>, do not blindly use it as such.
7 #ifndef __TINC_FIXEDINT_H__
8 #define __TINC_FIXEDINT_H__
10 #if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__WATCOMC__) && (defined(_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined(__UINT_FAST64_TYPE__)) )) && !defined(FIXEDINT_H_INCLUDED)
12 #define FIXEDINT_H_INCLUDED
14 #if defined(__WATCOMC__) && __WATCOMC__ >= 1250 && !defined(UINT64_C)
16 #define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
21 #ifndef FIXEDINT_H_INCLUDED
22 #define FIXEDINT_H_INCLUDED
26 #if (ULONG_MAX == 0xffffffffUL)
27 typedef unsigned long uint32_t;
28 #elif (UINT_MAX == 0xffffffffUL)
29 typedef unsigned int uint32_t;
30 #elif (USHRT_MAX == 0xffffffffUL)
31 typedef unsigned short uint32_t;
37 #if (LONG_MAX == 0x7fffffffL)
38 typedef signed long int32_t;
39 #elif (INT_MAX == 0x7fffffffL)
40 typedef signed int int32_t;
41 #elif (SHRT_MAX == 0x7fffffffL)
42 typedef signed short int32_t;
48 #if (defined(__STDC__) && defined(__STDC_VERSION__) && __STDC__ && __STDC_VERSION__ >= 199901L)
49 typedef long long int64_t;
50 typedef unsigned long long uint64_t;
52 #define UINT64_C(v) v ##ULL
53 #define INT64_C(v) v ##LL
54 #elif defined(__GNUC__)
55 __extension__ typedef long long int64_t;
56 __extension__ typedef unsigned long long uint64_t;
58 #define UINT64_C(v) v ##ULL
59 #define INT64_C(v) v ##LL
60 #elif defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__APPLE_CC__) || defined(_LONG_LONG) || defined(_CRAYC)
61 typedef long long int64_t;
62 typedef unsigned long long uint64_t;
64 #define UINT64_C(v) v ##ULL
65 #define INT64_C(v) v ##LL
66 #elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined(__BORLANDC__) && __BORLANDC__ > 0x460) || defined(__alpha) || defined(__DECC)
67 typedef __int64 int64_t;
68 typedef unsigned __int64 uint64_t;
70 #define UINT64_C(v) v ##UI64
71 #define INT64_C(v) v ##I64
75 static inline unsigned char shlu8(unsigned char a, uint32_t b) {
79 static inline int32_t shl32(uint32_t a, uint32_t b) {
83 static inline int64_t shl64(uint64_t a, uint32_t b) {
87 static inline uint64_t shlu64(uint64_t a, uint32_t b) {