You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the internal representation of bitfields in ctypes is a bit-packed number containing the size and offset. This is rather cumbersome to deal with. (As far as I can tell, the reason is that getters/setters take a single argument. But, these are internal so the signature can be changed.)
My plan is to break the CField size/offset information out into more wordy but explicit fields:
byte_size & byte_offset, which describe the byte-aligned field within a struct. (This has the same size as the underlying type, and must be fully contained in the struct & readable/writable.)
bit_size & bit_offset, which identify the bits within that chunk
Also, I intend to add corresponding attributes an the Python level, and expose _CField publicly as ctypes.CField, mainly for typing purposes. At this point I don't plan to make the type instantiable.
Feature or enhancement
Currently, the internal representation of bitfields in
ctypes
is a bit-packed number containing the size and offset. This is rather cumbersome to deal with. (As far as I can tell, the reason is that getters/setters take a single argument. But, these are internal so the signature can be changed.)My plan is to break the CField size/offset information out into more wordy but explicit fields:
byte_size
&byte_offset
, which describe the byte-aligned field within a struct. (This has the same size as the underlying type, and must be fully contained in the struct & readable/writable.)bit_size
&bit_offset
, which identify the bits within that chunkAlso, I intend to add corresponding attributes an the Python level, and expose
_CField
publicly asctypes.CField
, mainly for typing purposes. At this point I don't plan to make the type instantiable.Something like:
The text was updated successfully, but these errors were encountered: