Re: [PATCH v2 2/3] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc

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

 



On Sun, Feb 23, 2025 at 03:16:28PM +0000, Aditya Garg wrote:

> > Looking at the header files, it looks like doing cpu_to_le32 on that variable and doing le32_to_cpu will actually reverse the order twice, on big endian systems, thus technically all way would not swap the order at all.
> > 
> > I'm not really sure how to manage the sparse warnings here.
> 
> Not sure whether the maintainers would like it, but we can do something like this:

This is not what we want, I believe. And this looks like a reinventing a wheel
of cpu_to_*() and *_to_cpu() or similar macros.

> 	case 'l’:
> #ifdef __LITTLE_ENDIAN
> 		val = orig;
> #else
> 		orig = swab32(orig);
> 		val = orig;
> #endif
> 		break;
> 
> 	case 'b’:
> #ifdef __LITTLE_ENDIAN
> 		orig = swab32(orig);
> 		val = orig;
> #else
> 		val = orig;
> #endif
> 		break;

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux