1 /*************************************************************************/ /*!
2 @Title C99-compatible types and definitions for Linux kernel code
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
42 #include <linux/kernel.h>
44 /* Limits of specified-width integer types */
46 /* S8_MIN, etc were added in kernel version 3.14. The other versions are for
47 * earlier kernels. They can be removed once older kernels don't need to be
51 #define INT8_MIN S8_MIN
53 #define INT8_MIN (-128)
57 #define INT8_MAX S8_MAX
63 #define UINT8_MAX U8_MAX
65 #define UINT8_MAX 0xFF
69 #define INT16_MIN S16_MIN
71 #define INT16_MIN (-32768)
75 #define INT16_MAX S16_MAX
77 #define INT16_MAX 32767
81 #define UINT16_MAX U16_MAX
83 #define UINT16_MAX 0xFFFF
87 #define INT32_MIN S32_MIN
89 #define INT32_MIN (-2147483647 - 1)
93 #define INT32_MAX S32_MAX
95 #define INT32_MAX 2147483647
99 #define UINT32_MAX U32_MAX
101 #define UINT32_MAX 0xFFFFFFFF
105 #define INT64_MIN S64_MIN
107 #define INT64_MIN (-9223372036854775807LL)
111 #define INT64_MAX S64_MAX
113 #define INT64_MAX 9223372036854775807LL
117 #define UINT64_MAX U64_MAX
119 #define UINT64_MAX 0xFFFFFFFFFFFFFFFFULL
122 /* Macros for integer constants */
125 #define INT16_C S16_C
126 #define UINT16_C U16_C
127 #define INT32_C S32_C
128 #define UINT32_C U32_C
129 #define INT64_C S64_C
130 #define UINT64_C U64_C
132 /* Format conversion of integer types <inttypes.h> */
133 /* Only define PRIX64 for the moment, as this is the only format macro that