[PATCH 1/2] libstdc++: Replace padding bits with a bit-field in __format::_Spec
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Feb 1 17:28:37 GMT 2024
On Thu, 1 Feb 2024, 17:23 Jonathan Wakely, <jwakely@redhat.com> wrote:
> On Thu, 1 Feb 2024 at 16:34, Andreas Schwab <schwab@suse.de> wrote:
> >
> > On Feb 01 2024, Jonathan Wakely wrote:
> >
> > > This will result in an ABI change for targets that use 1-byte alignment
> > > for all integral types, e.g. cris-elf.
> >
> > Or 2-byte alignment as on m68k.
>
> Ah yes.
>
> In fact it's a change for everybody, because previously it was 15 bits
> of bit-fields, 1 bit padding, 2 x 16-bit short, 16 bits padding,
(Except for targets with 1- or 2-byte alignment, which didn't have the
second padding)
then
> a char32_t, but now it's 15+17 bits of bit-fields, 2x 16-bit short,
> char32_t. So the shorts moved internally even if the size didn't
> change.
>
> I could make it 15+1 bit-fields, 2x16-bit short, 16 bit-field to avoid
> moving the shorts.
>
> template<typename _CharT>
> struct _Spec
> {
> _Align _M_align : 2;
> _Sign _M_sign : 2;
> unsigned _M_alt : 1;
> unsigned _M_localized : 1;
> unsigned _M_zero_fill : 1;
> _WidthPrec _M_width_kind : 2;
> _WidthPrec _M_prec_kind : 2;
> _Pres_type _M_type : 4;
> unsigned _M_reserved : 1;
> unsigned short _M_width;
> unsigned short _M_prec;
> unsigned _M_reserved2 : 16;
> char32_t _M_fill = ' ';
>
> That would also address the PCC_BITFIELD_TYPE_MATTERS point H-P made.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240201/9040ea17/attachment-0001.htm>
More information about the Libstdc++
mailing list