1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef _CPR_LINUX_TYPES_H_
6 #define _CPR_LINUX_TYPES_H_
15 * Define boolean as an unsigned byte
17 * @note There are differences within TNP header files
18 * @li curses.h: bool => char
19 * @li types.h: boolean_t => enum
20 * @li dki_lock.h: bool_t => int
22 typedef uint8_t boolean
;
26 * defined in numerous header files
28 /* DONE (sys/types.h => unsigned int) */
33 /* DONE (sys/types.h => int) */
39 * The GNU versions of the MAX and MIN macros do two things better than
41 * 1. they are more optimal as they only evaluate a & b once by creating a
42 * a variable of each type on the local stack.
43 * 2. they fix potential errors due to side-effects where a and b were
44 * evaluated twice, i.e. MIN(i++,j++)
46 * @note b could be cast to a's type, to help with usage where the code
47 * compares signed and unsigned types.
51 #define MIN(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a < _b ? _a : _b; })
53 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
59 #define MAX(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a > _b ? _a : _b; })
61 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
67 * defined in several header files