Ignore:
File:
1 edited

Legend:

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

    r94795812 r5b382774  
    5252    uint64_t sz2)
    5353{
    54         uint64_t e1 = s1 + sz1 - 1;
    55         uint64_t e2 = s2 + sz2 - 1;
    56 
    57         /* both sizes are non-zero */
    58         if (sz1 && sz2)
    59                 return ((s1 <= e2) && (s2 <= e1));
    60 
    61         /* one size is non-zero */
    62         if (sz2)
    63                 return ((s1 >= s2) && (s1 <= e2));
    64         if (sz1)
    65                 return ((s2 >= s1) && (s2 <= e1));
    66 
    67         /* both are zero */
    68         return (s1 == s2);
     54        uint64_t e1 = s1 + sz1;
     55        uint64_t e2 = s2 + sz2;
     56       
     57        return ((s1 < e2) && (s2 < e1));
    6958}
    7059
     
    130119            | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32))
    131120
    132 /* Test for sum overflow. */
    133 #define overflows(a, b) \
    134         ((a) + (b) < (a))
    135 
    136 /* Test for sum overflow into positive numbers. */
    137 #define overflows_into_positive(a, b)   \
    138         (overflows((a), (b)) && ((a) + (b) > 0))
    139 
    140121/** Pseudorandom generator
    141122 *
     
    150131        })
    151132
     133
     134#ifndef member_to_inst
     135#define member_to_inst(ptr_member, type, member_identif) \
     136        ((type*) (((void*)(ptr_member)) - ((void*)&(((type*)0)->member_identif))))
     137#endif
     138
     139
    152140#endif
    153141
Note: See TracChangeset for help on using the changeset viewer.