Subversion Repositories Kolibri OS

Rev

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

Rev 1403 Rev 1404
Line 76... Line 76...
76
    typeof(x) _max1 = (x);          \
76
    typeof(x) _max1 = (x);          \
77
    typeof(y) _max2 = (y);          \
77
    typeof(y) _max2 = (y);          \
78
    (void) (&_max1 == &_max2);      \
78
    (void) (&_max1 == &_max2);      \
79
    _max1 > _max2 ? _max1 : _max2; })
79
    _max1 > _max2 ? _max1 : _max2; })
Line -... Line 80...
-
 
80
 
-
 
81
/*
-
 
82
 * ..and if you can't take the strict
-
 
83
 * types, you can specify one yourself.
-
 
84
 *
-
 
85
 * Or not use min/max/clamp at all, of course.
-
 
86
 */
-
 
87
#define min_t(type, x, y) ({            \
-
 
88
    type __min1 = (x);          \
-
 
89
    type __min2 = (y);          \
-
 
90
    __min1 < __min2 ? __min1: __min2; })
-
 
91
 
-
 
92
#define max_t(type, x, y) ({            \
-
 
93
    type __max1 = (x);          \
-
 
94
    type __max2 = (y);          \
-
 
95
    __max1 > __max2 ? __max1: __max2; })
80
 
96
 
81
/**
97
/**
82
 * container_of - cast a member of a structure out to the containing structure
98
 * container_of - cast a member of a structure out to the containing structure
83
 * @ptr:    the pointer to the member.
99
 * @ptr:    the pointer to the member.
84
 * @type:   the type of the container struct this is embedded in.
100
 * @type:   the type of the container struct this is embedded in.