Rev 1812 | Rev 2001 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1812 | Rev 1855 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
35 | #ifndef __MACROS_H__ |
35 | #ifndef KERN_MACROS_H_ |
36 | #define __MACROS_H__ |
36 | #define KERN_MACROS_H_ |
37 | 37 | ||
38 | #include <arch/types.h> |
38 | #include <arch/types.h> |
39 | #include <typedefs.h> |
39 | #include <typedefs.h> |
40 | 40 | ||
41 | #define is_digit(d) (((d) >= '0') && ((d) <= '9')) |
41 | #define is_digit(d) (((d) >= '0') && ((d) <= '9')) |
Line 46... | Line 46... | ||
46 | #define is_white(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) |
46 | #define is_white(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) |
47 | 47 | ||
48 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
48 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
49 | #define max(a,b) ((a) > (b) ? (a) : (b)) |
49 | #define max(a,b) ((a) > (b) ? (a) : (b)) |
50 | 50 | ||
51 | /** Return true if the interlvals overlap. */ |
51 | /** Return true if the interlvals overlap. |
- | 52 | * |
|
- | 53 | * @param s1 Start address of the first interval. |
|
- | 54 | * @param sz1 Size of the first interval. |
|
- | 55 | * @param s2 Start address of the second interval. |
|
- | 56 | * @param sz2 Size of the second interval. |
|
- | 57 | */ |
|
52 | static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2) |
58 | static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2) |
53 | { |
59 | { |
54 | uintptr_t e1 = s1 + sz1; |
60 | uintptr_t e1 = s1 + sz1; |
55 | uintptr_t e2 = s2 + sz2; |
61 | uintptr_t e2 = s2 + sz2; |
56 | 62 |