From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JjTWg-0003Bq-JN for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:11:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JjTWf-0003Be-RY for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:11:18 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JjTWf-0003Bb-Ng for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:11:17 -0400 Received: from smtp3-g19.free.fr ([212.27.42.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JjTWf-0004U1-8n for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:11:17 -0400 Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 7731117B534 for ; Wed, 9 Apr 2008 08:11:16 +0200 (CEST) Received: from [127.0.0.1] (rob92-10-88-171-126-33.fbx.proxad.net [88.171.126.33]) by smtp3-g19.free.fr (Postfix) with ESMTP id 505CC17B558 for ; Wed, 9 Apr 2008 08:11:16 +0200 (CEST) Message-ID: <47FC5E01.4080308@reactos.org> Date: Wed, 09 Apr 2008 08:11:13 +0200 From: =?ISO-8859-1?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] FDC: simplify code [v3] References: <47FA79D9.4050104@reactos.org> <47FBED6E.4080503@bellard.org> In-Reply-To: <47FBED6E.4080503@bellard.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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 Fabrice Bellard a =E9crit : > Herv=E9 Poussineau wrote: >> Hi, >> >> Attached patch prevents duplication of quite similar code in fdc.c, an= d >> 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. >> >> This version is quite similar to v1 (I removed the lookup table added = in >> 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... >=20 > 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. Thanks for the idea. I'll submit a patch for this later. Herv=E9