| Date | Tue, 27 Sep 2022 13:46:59 +0200 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH 14/23] thermal: intel: hfi: Update the class of the current task |
| |
On Fri, Sep 09, 2022 at 04:11:56PM -0700, Ricardo Neri wrote: > +union hfi_thread_feedback_char_msr { > + struct { > + u8 classid; > + u64 __reserved:55; > + u8 valid:1; > + } split; > + u64 full; > +};
Urgh, did you perhaps mean:
struct { u64 classid :8; u64 __reserved :55; u64 valid :1 };
?
Because yes, GCC does fold that into a single u64, but that's implementation defined behaviour; the C spec doesn't require one to pack adjacent bitfields of different types together.
I layout of:
u8 class; // offset 0 u64 __reserver : 55; // offset 8 u8 valid : 1; // offset 16
with a total size of 24 bytes is, AFAIU, a valid result of what you wrote.
|