lkml.org 
[lkml]   [2004]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.082 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site