Message ID | 20091007174553.GC11702@bombadil.infradead.org (mailing list archive) |
---|---|
State | RFC, archived |
Headers | show |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d3cd23f..4936eb6 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -51,6 +51,9 @@ extern const char linux_proc_banner[]; #define DIV_ROUND_CLOSEST(x, divisor)( \ { \ typeof(divisor) __divisor = divisor; \ + if (__builtin_types_compatible_p(typeof(divisor), unsigned long long) && \ + __builtin_popcountll(__divisor) == 1) \ + (((x) + ((__divisor) / 2) << __builtin_ffsll(__divisor))); \ (((x) + ((__divisor) / 2)) / (__divisor)); \ } \ )