Changeset d227101 in mainline for kernel/generic/include/macros.h


Ignore:
Timestamp:
2006-07-24T14:17:31Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4965a846
Parents:
f476e76
Message:

move macro and cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/macros.h

    rf476e76 rd227101  
    2727 */
    2828
    29  /** @addtogroup generic       
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3636#define __MACROS_H__
    3737
    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))
    4245#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'))
    4447
    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))
    4750
    4851/** Return true if the interlvals overlap. */
    4952static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, size_t sz2)
    5053{
    51         uintptr_t e1 = s1+sz1;
    52         uintptr_t e2 = s2+sz2;
     54        uintptr_t e1 = s1 + sz1;
     55        uintptr_t e2 = s2 + sz2;
    5356
    54         return s1 < e2 && s2 < e1;
     57        return (s1 < e2) && (s2 < e1);
    5558}
    5659/* 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
    5864
    5965#endif
    6066
    61  /** @}
     67/** @}
    6268 */
    63 
Note: See TracChangeset for help on using the changeset viewer.