3 * Copyright (c) 2001,2003 David H. Hovemeyer <daveho@cs.umd.edu>
6 * This is free software. You are permitted to use,
7 * redistribute, and modify it as specified in the file "COPYING".
10 #ifndef GEEKOS_KTYPES_H
11 #define GEEKOS_KTYPES_H
14 * GeekOS uses the C99 bool type, with true and false
20 * Shorthand for commonly used integer types.
22 typedef unsigned long ulong_t;
23 typedef unsigned int uint_t;
24 typedef unsigned short ushort_t;
25 typedef unsigned char uchar_t;
26 typedef unsigned long long ullong_t;
29 * MIN() and MAX() macros.
30 * By using gcc extensions, they are type-correct and
31 * evaulate their arguments only once.
33 #define MIN(a,b) ({typeof (a) _a = (a); typeof (b) _b = (b); (_a < _b) ? _a : _b; })
34 #define MAX(a,b) ({typeof (a) _a = (a); typeof (b) _b = (b); (_a < _b) ? _a : _b; })
37 * Some ASCII character access and manipulation macros.
39 #define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
40 #define TOLOWER(c) (((c) >= 'A' && (c) <= 'Z') ? ((c) + ('a' - 'A')) : (c))
41 #define TOUPPER(c) (((c) >= 'a' && (c) <= 'z') ? ((c) - ('a' - 'A')) : (c))
43 #endif /* GEEKOS_KTYPES_H */