On Wed, May 23, 2012 at 9:19 AM, Borislav Petkov <borislav.petkov@xxxxxxx> wrote: > > Actually we need a BIT() macro that works both > on 32- and 64-bit. But that won't be that easy: We could use __builtin_choose_expr(), but that *only* works with constants. So we could do this: static inline unsigned long bit(unsigned int x) { return 1ul << x; } static inline u64 bit64(unsigned int x) { return 1ull << x; } #define BIT(x) \ __builtin_choose_expr((x) < 8*sizeof(unsigned long), bit(x), bit64(x)) but then you *have* to use a plain constant for the BIT() macro. Anything else will error out in a big way. Non-constant users would have to be modified to use bit() and bit64() instead. And no, I tested. You apparently can't do #define __is_longlongshift(x) \ (__builtin_constant_p(x) && (x) < 8*(sizeof(long))) because while that is a compile-time constant expression, it's not "constant enough" for __builtin_choose_expr(). Linus -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html