[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/6] hw/usb/quirks: Use smaller types to reduce .rodata by 10
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 3/6] hw/usb/quirks: Use smaller types to reduce .rodata by 10KiB |
Date: |
Thu, 5 Mar 2020 11:41:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 3/5/20 9:02 AM, Gerd Hoffmann wrote:
struct usb_device_id {
- int vendor_id;
- int product_id;
- int interface_class;
- int interface_subclass;
- int interface_protocol;
+ int16_t vendor_id;
+ int16_t product_id;
+ int8_t interface_class;
+ int8_t interface_subclass;
+ int8_t interface_protocol;
I guess we should better use the uint variants here ...
I tried it first but I got:
CC hw/usb/quirks.o
hw/usb/quirks.c:25:34: error: result of comparison of constant -1 with
expression of type 'const uint16_t' (aka 'const unsigned short') is
always true [-Werror,-Wtautological-constant-out-of-range-compare]
for (i = 0; ids[i].vendor_id != -1; i++) {
~~~~~~~~~~~~~~~~ ^ ~~
hw/usb/quirks.c:28:37: error: result of comparison of constant -1 with
expression of type 'const uint8_t' (aka 'const unsigned char') is always
false [-Werror,-Wtautological-constant-out-of-range-compare]
(ids[i].interface_class == -1 ||
~~~~~~~~~~~~~~~~~~~~~~ ^ ~~
And went this less intrusive way.
I'll respin with s/-1/UINT8_MAX/.
[PATCH 2/6] hw/audio/fmopl: Move ENV_CURVE to .heap to save 32KiB of .bss, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 4/6] hw/audio/intel-hda: Use memory region alias to reduce .rodata by 4.34MB, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 5/6] ui/curses: Make control_characters[] array const, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 6/6] ui/curses: Move arrays to .heap to save 74KiB of .bss, Philippe Mathieu-Daudé, 2020/03/04