Changeset d227101 in mainline for kernel/generic/include/macros.h
- Timestamp:
- 2006-07-24T14:17:31Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4965a846
- Parents:
- f476e76
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/macros.h
rf476e76 rd227101 27 27 */ 28 28 29 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 36 36 #define __MACROS_H__ 37 37 38 #define is_digit(d) (((d) >= '0') && ((d)<='9')) 39 #define is_lower(c) (((c) >= 'a') && ((c) <= 'z')) 40 #define is_upper(c) (((c) >= 'A') && ((c) <= 'Z')) 41 #define is_alpha(c) (is_lower(c) || is_upper(c)) 38 #include <arch/types.h> 39 #include <typedefs.h> 40 41 #define is_digit(d) (((d) >= '0') && ((d) <= '9')) 42 #define is_lower(c) (((c) >= 'a') && ((c) <= 'z')) 43 #define is_upper(c) (((c) >= 'A') && ((c) <= 'Z')) 44 #define is_alpha(c) (is_lower(c) || is_upper(c)) 42 45 #define is_alphanum(c) (is_alpha(c) || is_digit(c)) 43 #define is_white(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))46 #define is_white(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) 44 47 45 #define min(a,b) ((a) <(b)?(a):(b))46 #define max(a,b) ((a) >(b)?(a):(b))48 #define min(a,b) ((a) < (b) ? (a) : (b)) 49 #define max(a,b) ((a) > (b) ? (a) : (b)) 47 50 48 51 /** Return true if the interlvals overlap. */ 49 52 static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2) 50 53 { 51 uintptr_t e1 = s1 +sz1;52 uintptr_t e2 = s2 +sz2;54 uintptr_t e1 = s1 + sz1; 55 uintptr_t e2 = s2 + sz2; 53 56 54 return s1 < e2 && s2 < e1;57 return (s1 < e2) && (s2 < e1); 55 58 } 56 59 /* Compute overlapping of physical addresses */ 57 #define PA_overlaps(x,szx,y,szy) overlaps(KA2PA(x),szx,KA2PA(y), szy) 60 #define PA_overlaps(x, szx, y, szy) overlaps(KA2PA(x), szx, KA2PA(y), szy) 61 62 #define STRING(arg) STRING_ARG(arg) 63 #define STRING_ARG(arg) #arg 58 64 59 65 #endif 60 66 61 67 /** @} 62 68 */ 63
Note:
See TracChangeset
for help on using the changeset viewer.