[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] FDC: simplify code [v3]
From: |
Fabrice Bellard |
Subject: |
Re: [Qemu-devel] [PATCH] FDC: simplify code [v3] |
Date: |
Wed, 09 Apr 2008 00:10:54 +0200 |
User-agent: |
Thunderbird 1.5.0.9 (X11/20070212) |
Hervé Poussineau wrote:
> Hi,
>
> 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.
>
> 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...
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.