[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/4] hw/ds1338.c: Fix handling of HOURS register
From: |
Antoine Mathys |
Subject: |
Re: [Qemu-devel] [PATCH 1/4] hw/ds1338.c: Fix handling of HOURS register. |
Date: |
Tue, 04 Dec 2012 21:57:43 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 12/04/2012 06:42 PM, Peter Maydell wrote:
This looks good as far as the logic goes, but I think we could use
some symbolic constants for the 12-hour and PM bits rather than all
the literal 0x20 0x40 0x60. thanks -- PMM
I refrained from using symbolic constants for three reasons:
1. You need to refer to the datasheet anyway to understand what is going on.
2. The code is short and it is easy to keep track of a few constants.
3. Symbolic names, which can be quite long, tend to make the code harder
rather than easier to read
It is largely a matter of preference though and I'm not opposed to the
idea. I would appreciate naming suggestions though.
I propose not to have symbolic constants for the registers and to use
CH, OSF, MODE12, PM for the various bits, provided such short names are
acceptable. I'd really hate something like REG_HOURS_MODE12.