From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JjM2j-0005o7-KJ for qemu-devel@nongnu.org; Tue, 08 Apr 2008 18:11:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JjM2i-0005nu-6F for qemu-devel@nongnu.org; Tue, 08 Apr 2008 18:11:53 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JjM2i-0005nr-3C for qemu-devel@nongnu.org; Tue, 08 Apr 2008 18:11:52 -0400 Received: from relay3-v.mail.gandi.net ([217.70.178.77]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JjM2h-0004Fn-Kb for qemu-devel@nongnu.org; Tue, 08 Apr 2008 18:11:51 -0400 Received: from localhost (mfilter1-v.gandi.net [217.70.178.35]) by relay3-v.mail.gandi.net (Postfix) with ESMTP id 25415BA0B for ; Wed, 9 Apr 2008 00:11:51 +0200 (CEST) Received: from relay3-v.mail.gandi.net ([217.70.178.77]) by localhost (mfilter1-v.gandi.net [217.70.178.35]) (amavisd-new, port 10024) with ESMTP id VwGKoQOJtmR7 for ; Wed, 9 Apr 2008 00:11:50 +0200 (CEST) Received: from [84.102.211.19] (19.211.102-84.rev.gaoland.net [84.102.211.19]) by relay3-v.mail.gandi.net (Postfix) with ESMTP id 3FC6DB9FF for ; Wed, 9 Apr 2008 00:11:35 +0200 (CEST) Message-ID: <47FBED6E.4080503@bellard.org> Date: Wed, 09 Apr 2008 00:10:54 +0200 From: Fabrice Bellard MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] FDC: simplify code [v3] References: <47FA79D9.4050104@reactos.org> In-Reply-To: <47FA79D9.4050104@reactos.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Herv=E9 Poussineau wrote: > Hi, >=20 > Attached patch prevents duplication of quite similar code in fdc.c, and > so, removes 300 lines and 8KB of code. > It first extracts implementation of FDC commands to separate methods, > and then uses a table to know which method to execute instead of a big > switch. >=20 > This version is quite similar to v1 (I removed the lookup table added i= n > v2), except that I tried to minimize the time spent to search in the > command table by putting most used commands at the beginning. I don't > have any statistics to proove the order, that's only observation and > guess... A lookup table could be generated dynamically from your table by using a few lines of code... You current solution is very slow, but you are saved by the fact that the FDC speed is not critical anyway. Fabrice.