Andrew Morton wrote:
>
> For uniprocessors this:
>
> const int cpu = smp_processor_id();
> if (dev->xmit_lock_owner != cpu) {
>
> generates faster code than this:
>
> int cpu = smp_processor_id();
> if (dev->xmit_lock_owner != cpu) {
>
> This is because the macro 'smp_processor_id()' evaluates to a constant.
>
> When the identifier is declared const the compiler propagates this
> knowledge and replaces it with the constant throughout. It's a win in
> comparisons and in array subscripting.
gcc version?
[for cases i tried in the past it always made no difference,
a quick test w/ gcc2.95 shows no difference.]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:10 EST