Re: [RFC, 2.6] a simple FIFO implementation

From: Hugh Dickins
Date: Fri Sep 17 2004 - 11:30:42 EST


On Fri, 17 Sep 2004, Stelian Pop wrote:
> + * The size will be rounded-up to a power of 2.

> + l = min(len, fifo->size - (fifo->in % fifo->size));
> + memcpy(fifo->buffer + (fifo->in % fifo->size), buffer, l);

> + l = min(len, fifo->size - (fifo->out % fifo->size));
> + memcpy(buffer, fifo->buffer + (fifo->out % fifo->size), l);

The moduli can now be replaced by faster masks "& (fifo->size - 1)".

Hugh

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