[PATCH v4 1/3] lib/vsprintf: Add support for generic FourCCs by extending %p4cc

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Apr 22 10:12:35 UTC 2025


On Tue, Apr 22, 2025 at 10:07:33AM +0200, Geert Uytterhoeven wrote:
> On Tue, 8 Apr 2025 at 08:48, Aditya Garg <gargaditya08 at live.com> wrote:

...

> > +Generic FourCC code
> > +-------------------
> > +
> > +::
> > +       %p4c[hnlb]      gP00 (0x67503030)
> > +
> > +Print a generic FourCC code, as both ASCII characters and its numerical
> > +value as hexadecimal.
> > +
> > +The generic FourCC code is always printed in the big-endian format,
> > +the most significant byte first. This is the opposite of V4L/DRM FourCCs.
> > +
> > +The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what
> > +endianness is used to load the stored bytes. The data might be interpreted
> > +using the host byte order, network byte order, little-endian, or big-endian.
> > +
> > +Passed by reference.
> > +
> > +Examples for a little-endian machine, given &(u32)0x67503030::
> > +
> > +       %p4ch   gP00 (0x67503030)
> > +       %p4cn   00Pg (0x30305067)
> > +       %p4cl   gP00 (0x67503030)
> > +       %p4cb   00Pg (0x30305067)
> > +
> > +Examples for a big-endian machine, given &(u32)0x67503030::
> > +
> > +       %p4ch   gP00 (0x67503030)
> > +       %p4cn   00Pg (0x30305067)
> 
> This doesn't look right to me, as network byte order is big endian?
> Note that I didn't check the code.

Yes, network is big endian and this seems right to me. What is the confusion?

> > +       %p4cl   00Pg (0x30305067)
> > +       %p4cb   gP00 (0x67503030)

-- 
With Best Regards,
Andy Shevchenko




More information about the dri-devel mailing list