Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / third_party / sipcc / cpr_darwin_types.h
blob97a2644b57146d4fbac12bebf0e7536d6d2e9dd3
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_DARWIN_TYPES_H_
6 #define _CPR_DARWIN_TYPES_H_
8 #include <sys/types.h>
9 #include <sys/param.h>
10 #include <stddef.h>
11 #include "inttypes.h"
14 /**
15 * @typedef boolean
17 * Define boolean as an unsigned byte
19 * @note There are differences within TNP header files
20 * @li curses.h: bool => char
21 * @li types.h: boolean_t => enum
22 * @li dki_lock.h: bool_t => int
24 typedef uint8_t boolean;
27 * Define min/max
28 * defined in param.h
30 * The GNU versions of the MAX and MIN macros do two things better than
31 * the old versions:
32 * 1. they are more optimal as they only evaluate a & b once by creating a
33 * a variable of each type on the local stack.
34 * 2. they fix potential errors due to side-effects where a and b were
35 * evaluated twice, i.e. MIN(i++,j++)
37 * @note b could be cast to a's type, to help with usage where the code
38 * compares signed and unsigned types.
40 #ifndef MIN
41 #ifdef __GNUC__
42 #define MIN(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a < _b ? _a : _b; })
43 #else
44 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
45 #endif
46 #endif
48 #ifndef MAX
49 #ifdef __GNUC__
50 #define MAX(a,b) ({ typeof(a) _a = (a); typeof(b) _b = (b); _a > _b ? _a : _b; })
51 #else
52 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
53 #endif
54 #endif
56 /**
57 * Define TRUE/FALSE
58 * defined in several header files
60 #ifndef TRUE
61 #define TRUE 1
62 #endif
64 #ifndef FALSE
65 #define FALSE 0
66 #endif
68 #endif