[lkml]   [2004]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [RFC, 2.6] a simple FIFO implementation
    Peter Chubb wrote:

    > This depends on how expensive % is. On IA64, something like this:
    > add(char c) {
    > int i = p->head == p->len ? p->head++ : 0;
    > p->buf[i] = c;
    > }
    > is cheaper, as % generates a subroutine call to __modsi3. It also is
    > shorter =-- 12 bundles as opposed to 15.

    I did a similar test once for ppc that found that an increment followed by a
    test (marked unlikely) was actually quicker in practice than modulo arithmetic.
    The branch predictor got it right most of the time, so the test was almost free.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:06    [W:0.019 / U:7.788 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site