Subversion Repositories HelenOS

Rev

Rev 1787 | Rev 1855 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1787 Rev 1812
Line 33... Line 33...
33
 */
33
 */
34
 
34
 
35
#ifndef __MACROS_H__
35
#ifndef __MACROS_H__
36
#define __MACROS_H__
36
#define __MACROS_H__
37
 
37
 
-
 
38
#include <arch/types.h>
-
 
39
#include <typedefs.h>
-
 
40
 
38
#define is_digit(d) (((d) >= '0') && ((d)<='9'))
41
#define is_digit(d)     (((d) >= '0') && ((d) <= '9'))
39
#define is_lower(c) (((c) >= 'a') && ((c) <= 'z'))
42
#define is_lower(c)     (((c) >= 'a') && ((c) <= 'z'))
40
#define is_upper(c) (((c) >= 'A') && ((c) <= 'Z'))
43
#define is_upper(c)     (((c) >= 'A') && ((c) <= 'Z'))
41
#define is_alpha(c) (is_lower(c) || is_upper(c))
44
#define is_alpha(c)     (is_lower(c) || is_upper(c))
42
#define is_alphanum(c)  (is_alpha(c) || is_digit(c))
45
#define is_alphanum(c)  (is_alpha(c) || is_digit(c))
Line 49... Line 52...
49
static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)
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;
54
    uintptr_t e1 = s1 + sz1;
52
    uintptr_t e2 = s2+sz2;
55
    uintptr_t e2 = s2 + sz2;
53
 
56
 
54
    return s1 < e2 && s2 < e1;
57
    return (s1 < e2) && (s2 < e1);
55
}
58
}
56
/* Compute overlapping of physical addresses */
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)
58
 
61
 
-
 
62
#define STRING(arg) STRING_ARG(arg)
-
 
63
#define STRING_ARG(arg) #arg
-
 
64
 
59
#endif
65
#endif
60
 
66
 
61
 /** @}
67
/** @}
62
 */
68
 */
63
 
-