From: Eric D. <eri...@gm...> - 2012-05-30 11:59:27
|
On Wed, 2012-05-30 at 04:20 -0700, Joe Perches wrote: > On Wed, 2012-05-30 at 13:08 +0200, Eric Dumazet wrote: > > Maybe we should change all POSDIFF(), not selected ones. > > #define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0) > > maybe use an eval once statement expression macro > ({ > typeof (A) _a = (A); > typeof (B) _b = (B); > ((int)(_a - _b) > 0 ? _a - _b : 0; > }) > > Well, many choices are possible, including #define POSDIFF(A, B) max_t(int, (A) - (B), 0); |