Correct license information
[platform/adaptation/broadcom/libomxil-vc4.git] / containers / containers_types.h
1 /*
2 Copyright (c) 2012, Broadcom Europe Ltd
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7     * Redistributions of source code must retain the above copyright
8       notice, this list of conditions and the following disclaimer.
9     * Redistributions in binary form must reproduce the above copyright
10       notice, this list of conditions and the following disclaimer in the
11       documentation and/or other materials provided with the distribution.
12     * Neither the name of the copyright holder nor the
13       names of its contributors may be used to endorse or promote products
14       derived from this software without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 #ifndef VC_CONTAINERS_TYPES_H
28 #define VC_CONTAINERS_TYPES_H
29
30 /** \file containers_types.h
31  * Definition of types used by the containers API
32  */
33
34 #include <stdlib.h>
35 #include <stdarg.h>
36 #include <string.h>
37 #include <stddef.h>
38
39 #if defined( __STDC__ ) && defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
40 #include <stdint.h>
41 #include <inttypes.h>
42
43 #elif defined( __GNUC__ )
44 #include <stdint.h>
45 #include <inttypes.h>
46
47 #elif defined(_MSC_VER)
48 #include <stdint.h>
49 #if (_MSC_VER < 1700)
50 typedef          __int8    int8_t;
51 typedef unsigned __int8    uint8_t;
52 typedef          __int16   int16_t;
53 typedef unsigned __int16   uint16_t;
54 typedef          __int32   int32_t;
55 typedef unsigned __int32   uint32_t;
56 typedef          __int64   int64_t;
57 typedef unsigned __int64   uint64_t;
58 #endif
59 #define PRIu16 "u"
60 #define PRIu32 "u"
61 #define PRId64 "I64d"
62 #define PRIi64 "I64i"
63 #define PRIo64 "I64o"
64 #define PRIu64 "I64u"
65 #define PRIx64 "I64x"
66
67 #else
68 typedef signed   char      int8_t;
69 typedef unsigned char      uint8_t;
70 typedef signed   short     int16_t;
71 typedef unsigned short     uint16_t;
72 typedef signed   long      int32_t;
73 typedef unsigned long      uint32_t;
74 typedef signed   long long int64_t;
75 typedef unsigned long long uint64_t;
76 #endif
77
78 /* C99 64bits integers */
79 #ifndef INT64_C
80 # define INT64_C(value) value##LL
81 # define UINT64_C(value) value##ULL
82 #endif
83
84 /* C99 boolean */
85 #ifndef __cplusplus
86 #ifndef bool
87 # define bool int
88 #endif
89 #ifndef true
90 # define true 1
91 #endif
92 #ifndef false
93 # define false 0
94 #endif
95 #endif /* __cplusplus */
96
97 /* FIXME: should be different for big endian */
98 #define VC_FOURCC(a,b,c,d) ((a) | (b << 8) | (c << 16) | (d << 24))
99
100 #endif /* VC_CONTAINERS_TYPES_H */