Messages in this thread | | | Date | Fri, 17 Sep 2004 17:14:06 +0100 (BST) | From | Hugh Dickins <> | Subject | Re: [RFC, 2.6] a simple FIFO implementation |
| |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |