qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/3] docs/devel/style: add a section about bitfield, and d


From: Richard Henderson
Subject: Re: [PATCH v2 2/3] docs/devel/style: add a section about bitfield, and disallow them for packed structures
Date: Wed, 27 Nov 2024 21:07:09 -0600
User-agent: Mozilla Thunderbird

On 11/27/24 19:01, Pierrick Bouvier wrote:
On 11/27/24 09:46, Richard Henderson wrote:
On 11/26/24 18:15, Pierrick Bouvier wrote:
Except for saving memory in *very* specific case (a structure allocated tens of 
millions
times for example), I hardly see a benefit vs using integer types.

Even then, 'uint32_t flags' can be just as easy to use as unsigned foo:1, 
bar:1, etc:1.
Plus you get knowledge of the actual structure layout, which is presumably 
important
*because* it's allocated millions of times.


r~


Do we have a specific API (or set of macros) in QEMU to help with this?
If yes, maybe I could mention it in the doc ("we recommend using X instead of 
bitfields").

Yes, include/hw/registerfields.h.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]