lkml.org 
[lkml]   [2007]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] mtrr use type bool
    From
    On Wed, Oct 31, 2007 at 04:27:31PM +0100, Richard Knutsson wrote:
    > Paul Jimenez wrote:
    ....
    > >- usage_table[i] = usage_table[replace] + !!increment;
    > >+ usage_table[i] = usage_table[replace] + increment;
    > >
    > This seems a bit strange, using a boolean as an integer (yes I know, it
    > works but semantically...). What about:
    >
    > + usage_table[i] = usage_table[replace];
    > + usage_table[i] += increment ? 1 : 0;

    What is wrong with:
    usage_table[i] = usage_table[replace];
    if (increment)
    usage_table[i]++;

    I hate code with the '?' operator in general. It's a conditional either
    way, and at least this way you wouldn't even have to do a store in one
    of the two cases 9although if the compiler can't figure out that is the
    case already, then it really sucks).

    Pauls code at least didn't involve a conditional at all, but on the
    other hand is less clear to read.

    --
    Len Sorensen
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-10-31 17:47    [W:2.408 / U:0.256 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site