Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265029AbUIQBAl (ORCPT ); Thu, 16 Sep 2004 21:00:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265900AbUIQBAi (ORCPT ); Thu, 16 Sep 2004 21:00:38 -0400 Received: from mail14.syd.optusnet.com.au ([211.29.132.195]:64956 "EHLO mail14.syd.optusnet.com.au") by vger.kernel.org with ESMTP id S265029AbUIQBAg (ORCPT ); Thu, 16 Sep 2004 21:00:36 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16714.14118.212946.499226@wombat.chubb.wattle.id.au> Date: Fri, 17 Sep 2004 11:00:22 +1000 From: Peter Chubb To: Andrew Morton Cc: Stelian Pop , linux-kernel@vger.kernel.org Subject: Re: [RFC, 2.6] a simple FIFO implementation In-Reply-To: <260353727@toto.iv> X-Mailer: VM 7.17 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid Comments: Hyperbole mail buttons accepted, v04.18. X-Face: GgFg(Z>fx((4\32hvXq<)|jndSniCH~~$D)Ka:P@e@JR1P%Vr}EwUdfwf-4j\rUs#JR{'h# !]])6%Jh~b$VA|ALhnpPiHu[-x~@<"@Iv&|%R)Fq[[,(&Z'O)Q)xCqe1\M[F8#9l8~}#u$S$Rm`S9% \'T@`:&8>Sb*c5d'=eDYI&GF`+t[LfDH="MP5rwOO]w>ALi7'=QJHz&y&C&TE_3j! Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 929 Lines: 30 >>>>> "Andrew" == Andrew Morton writes: Andrew> All the struct needs is `head', `tail' and Andrew> `number_of_bytes_at_buf', all unsigned. Andrew> add(char c) { Andrew> p-> buf[p->head++ % p->number_of_bytes_at_buf] = c; Andrew> } 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. -- Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au The technical we do immediately, the political takes *forever* - 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/