Merge "param.h: whitespace cleanup" am: 29a89df9e2
am: a201789ffa
am: 5327dd83f6
Change-Id: Ie3e41344c4f8452dc6c5cf4f8a5163679f724ee8
This commit is contained in:
commit
539191979d
1 changed files with 7 additions and 5 deletions
|
@ -51,17 +51,19 @@
|
|||
#endif
|
||||
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns true if the binary representation of the argument is all zeros
|
||||
* or has exactly one bit set. Contrary to the macro name, this macro
|
||||
* DOES NOT determine if the provided value is a power of 2. In particular,
|
||||
* this function falsely returns true for powerof2(0) and some negative
|
||||
* numbers.
|
||||
*/
|
||||
#define powerof2(x) \
|
||||
({ __typeof__(x) _x = (x); \
|
||||
__typeof__(x) _x2; \
|
||||
__builtin_add_overflow(_x, -1, &_x2) ? 1 : ((_x2&_x) == 0 ); })
|
||||
#define powerof2(x) \
|
||||
({ \
|
||||
__typeof__(x) _x = (x); \
|
||||
__typeof__(x) _x2; \
|
||||
__builtin_add_overflow(_x, -1, &_x2) ? 1 : ((_x2 & _x) == 0); \
|
||||
})
|
||||
|
||||
/** Returns the lesser of its two arguments. */
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
|
|
Loading…
Reference in a new issue