[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v10 13/13] qemu/bitops.h: Add extract8 and extra
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v10 13/13] qemu/bitops.h: Add extract8 and extract16 |
Date: |
Wed, 8 May 2019 10:37:30 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 5/8/19 7:56 AM, Yoshinori Sato wrote:
> +static inline uint16_t extract16(uint32_t value, int start, int length)
s/uint32_t/uint16_t/
Aside from the possible value of the more restrictive asserts, I'm not sure
what advantage you see in these routines. All arithmetic in C is promoted to
type "int", which for all supported hosts is 32-bits.
This suggests an implementation for these functions as
assert(...);
return extract32(value, start, length);
because otherwise the (32 - length) subexpression might at first glance appear
to be a cut-and-paste bug. Whereas it's really required by the larger
subexpression.
r~
- Re: [Qemu-devel] [PATCH v10 05/13] target/rx: Miscellaneous files, (continued)
- [Qemu-devel] [PATCH v10 03/13] target/rx: CPU definition, Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 06/13] hw/intc: RX62N interrupt controller (ICUa), Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 08/13] hw/char: RX62N serial communication interface (SCI), Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 12/13] hw/registerfields.h: Add 8bit and 16bit register macros., Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 13/13] qemu/bitops.h: Add extract8 and extract16, Yoshinori Sato, 2019/05/08
- Re: [Qemu-devel] [PATCH v10 13/13] qemu/bitops.h: Add extract8 and extract16,
Richard Henderson <=
- [Qemu-devel] [PATCH v10 09/13] hw/rx: RX Target hardware definition, Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 07/13] hw/timer: RX62N internal timer modules, Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 04/13] target/rx: RX disassembler, Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 02/13] target/rx: TCG helper, Yoshinori Sato, 2019/05/08
- [Qemu-devel] [PATCH v10 01/13] target/rx: TCG translation, Yoshinori Sato, 2019/05/08