1 /*
2  *  Copyright (c) 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 <stdint.h>  // for uintptr_t
18 #endif
19 
20 #ifndef INT_TYPES_DEFINED
21 #define INT_TYPES_DEFINED
22 #ifdef COMPILER_MSVC
23 typedef unsigned __int64 uint64;
24 typedef __int64 int64;
25 #ifndef INT64_C
26 #define INT64_C(x) x ## I64
27 #endif
28 #ifndef UINT64_C
29 #define UINT64_C(x) x ## UI64
30 #endif
31 #define INT64_F "I64"
32 #else  // COMPILER_MSVC
33 #ifdef __LP64__
34 typedef unsigned long uint64;
35 typedef long int64;
36 #ifndef INT64_C
37 #define INT64_C(x) x ## L
38 #endif
39 #ifndef UINT64_C
40 #define UINT64_C(x) x ## UL
41 #endif
42 #define INT64_F "l"
43 #else  // __LP64__
44 typedef unsigned long long uint64;
45 typedef long long int64;
46 #ifndef INT64_C
47 #define INT64_C(x) x ## LL
48 #endif
49 #ifndef UINT64_C
50 #define UINT64_C(x) x ## ULL
51 #endif
52 #define INT64_F "ll"
53 #endif  // __LP64__
54 #endif  // COMPILER_MSVC
55 typedef unsigned int uint32;
56 typedef int int32;
57 typedef unsigned short uint16;
58 typedef short int16;
59 typedef unsigned char uint8;
60 typedef char int8;
61 #endif  // INT_TYPES_DEFINED
62 
63 // Detect compiler is for x86 or x64.
64 #if defined(__x86_64__) || defined(_M_X64) || \
65     defined(__i386__) || defined(_M_IX86)
66 #define CPU_X86 1
67 #endif
68 
69 #define ALIGNP(p, t) \
70   ((uint8*)((((uintptr_t)(p) + \
71   ((t)-1)) & ~((t)-1))))
72 
73 #endif // INCLUDE_LIBYUV_BASIC_TYPES_H_
74