Changeset 6bf612b in mainline
- Timestamp:
- 2009-02-17T22:44:13Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e662a5f
- Parents:
- d6b8e9d8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/macros.h
rd6b8e9d8 r6bf612b 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 38 38 #include <arch/types.h> 39 39 40 #define isdigit(d) 41 #define islower(c) 42 #define isupper(c) 43 #define isalpha(c) 44 #define isalphanum(c) 45 #define isspace(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') ||\46 40 #define isdigit(d) (((d) >= '0') && ((d) <= '9')) 41 #define islower(c) (((c) >= 'a') && ((c) <= 'z')) 42 #define isupper(c) (((c) >= 'A') && ((c) <= 'Z')) 43 #define isalpha(c) (is_lower((c)) || is_upper((c))) 44 #define isalphanum(c) (is_alpha((c)) || is_digit((c))) 45 #define isspace(c) \ 46 (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) 47 47 48 #define min(a, b) ((a) < (b) ? (a) : (b)) 49 #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)) 50 51 #define min3(a, b, c) ((a) < (b) ? (min(a, c)) : (min(b, c))) 52 #define max3(a, b, c) ((a) > (b) ? (max(a, c)) : (max(b, c))) 50 53 51 54 /** Return true if the intervals overlap. 52 55 * 53 * @param s1 54 * @param sz1 55 * @param s2 56 * @param sz2 56 * @param s1 Start address of the first interval. 57 * @param sz1 Size of the first interval. 58 * @param s2 Start address of the second interval. 59 * @param sz2 Size of the second interval. 57 60 */ 58 61 static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2) … … 60 63 uintptr_t e1 = s1 + sz1; 61 64 uintptr_t e2 = s2 + sz2; 62 63 return ( s1 < e2) && (s2 < e1);65 66 return ((s1 < e2) && (s2 < e1)); 64 67 } 65 68 66 69 /* Compute overlapping of physical addresses */ 67 #define PA_overlaps(x, szx, y, szy) 70 #define PA_overlaps(x, szx, y, szy) \ 68 71 overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy)) 69 72 70 #define SIZE2KB(size) ((size) >> 10)71 #define SIZE2MB(size) ((size) >> 20)73 #define SIZE2KB(size) ((size) >> 10) 74 #define SIZE2MB(size) ((size) >> 20) 72 75 73 #define KB2SIZE(kb) ((kb) << 10)74 #define MB2SIZE(mb) ((mb) << 20)76 #define KB2SIZE(kb) ((kb) << 10) 77 #define MB2SIZE(mb) ((mb) << 20) 75 78 76 #define STRING(arg) STRING_ARG(arg)77 #define STRING_ARG(arg) #arg79 #define STRING(arg) STRING_ARG(arg) 80 #define STRING_ARG(arg) #arg 78 81 79 82 /** Pseudorandom generator
Note:
See TracChangeset
for help on using the changeset viewer.