webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
basic_types.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3  *
4  * Use of this source code is governed by a BSD-style license
5  * that can be found in the LICENSE file in the root of the source
6  * tree. An additional intellectual property rights grant can be found
7  * in the file PATENTS. All contributing project authors may
8  * be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_
12 #define INCLUDE_LIBYUV_BASIC_TYPES_H_
13 
14 #include <stddef.h> // for NULL, size_t
15 
16 #if defined(_MSC_VER) && (_MSC_VER < 1600)
17 #include <sys/types.h> // for uintptr_t on x86
18 #else
19 #include <stdint.h> // for uintptr_t
20 #endif
21 
22 #ifndef GG_LONGLONG
23 #ifndef INT_TYPES_DEFINED
24 #define INT_TYPES_DEFINED
25 #ifdef COMPILER_MSVC
26 typedef unsigned __int64 uint64;
27 typedef __int64 int64;
28 #ifndef INT64_C
29 #define INT64_C(x) x ## I64
30 #endif
31 #ifndef UINT64_C
32 #define UINT64_C(x) x ## UI64
33 #endif
34 #define INT64_F "I64"
35 #else // COMPILER_MSVC
36 #if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
37 typedef unsigned long uint64; // NOLINT
38 typedef long int64; // NOLINT
39 #ifndef INT64_C
40 #define INT64_C(x) x ## L
41 #endif
42 #ifndef UINT64_C
43 #define UINT64_C(x) x ## UL
44 #endif
45 #define INT64_F "l"
46 #else // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
47 typedef unsigned long long uint64; // NOLINT
48 typedef long long int64; // NOLINT
49 #ifndef INT64_C
50 #define INT64_C(x) x ## LL
51 #endif
52 #ifndef UINT64_C
53 #define UINT64_C(x) x ## ULL
54 #endif
55 #define INT64_F "ll"
56 #endif // __LP64__
57 #endif // COMPILER_MSVC
58 typedef unsigned int uint32;
59 typedef int int32;
60 typedef unsigned short uint16; // NOLINT
61 typedef short int16; // NOLINT
62 typedef unsigned char uint8;
63 typedef signed char int8;
64 #endif // INT_TYPES_DEFINED
65 #endif // GG_LONGLONG
66 
67 // Detect compiler is for x86 or x64.
68 #if defined(__x86_64__) || defined(_M_X64) || \
69  defined(__i386__) || defined(_M_IX86)
70 #define CPU_X86 1
71 #endif
72 // Detect compiler is for ARM.
73 #if defined(__arm__) || defined(_M_ARM)
74 #define CPU_ARM 1
75 #endif
76 
77 #ifndef ALIGNP
78 #ifdef __cplusplus
79 #define ALIGNP(p, t) \
80  (reinterpret_cast<uint8*>(((reinterpret_cast<uintptr_t>(p) + \
81  ((t) - 1)) & ~((t) - 1))))
82 #else
83 #define ALIGNP(p, t) \
84  ((uint8*)((((uintptr_t)(p) + ((t) - 1)) & ~((t) - 1)))) /* NOLINT */
85 #endif
86 #endif
87 
88 #if !defined(LIBYUV_API)
89 #if defined(_WIN32) || defined(__CYGWIN__)
90 #if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
91 #define LIBYUV_API __declspec(dllexport)
92 #elif defined(LIBYUV_USING_SHARED_LIBRARY)
93 #define LIBYUV_API __declspec(dllimport)
94 #else
95 #define LIBYUV_API
96 #endif // LIBYUV_BUILDING_SHARED_LIBRARY
97 #elif defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__APPLE__) && \
98  (defined(LIBYUV_BUILDING_SHARED_LIBRARY) || \
99  defined(LIBYUV_USING_SHARED_LIBRARY))
100 #define LIBYUV_API __attribute__ ((visibility ("default")))
101 #else
102 #define LIBYUV_API
103 #endif // __GNUC__
104 #endif // LIBYUV_API
105 
106 #define LIBYUV_BOOL int
107 #define LIBYUV_FALSE 0
108 #define LIBYUV_TRUE 1
109 
110 // Visual C x86 or GCC little endian.
111 #if defined(__x86_64__) || defined(_M_X64) || \
112  defined(__i386__) || defined(_M_IX86) || \
113  defined(__arm__) || defined(_M_ARM) || \
114  (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
115 #define LIBYUV_LITTLE_ENDIAN
116 #endif
117 
118 #endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
signed char int8
Definition: basic_types.h:63
unsigned char uint8
Definition: basic_types.h:62
unsigned long long uint64
Definition: basic_types.h:47
long long int64
Definition: basic_types.h:48
short int16
Definition: basic_types.h:61
int int32
Definition: basic_types.h:59
unsigned int uint32
Definition: basic_types.h:58
unsigned short uint16
Definition: basic_types.h:60