RE: [PATCH v7 01/10] Consolidate IO memcpy/memset into iomap_copy.c

David Laight <[email protected]>
Newsgroups gmane.linux.ports.parisc,gmane.linux.ports.arm.kernel,gmane.linux.kernel,gmane.linux.ports.alpha,gmane.linux.ports.sh.devel,gmane.linux.uml.devel,gmane.linux.kernel.cross-arch
Message-ID <[email protected]>
From: Richard Henderson
> Sent: 03 October 2024 17:47
> 
> On 9/30/24 06:23, Julian Vetter wrote:
> > +void memset_io(volatile void __iomem *dst, int c, size_t count)
> > +{
> > +	uintptr_t qc = (u8)c;
> 
> Missed one change to 'long'
> 
> > +
> > +	qc |= qc << 8;
> > +	qc |= qc << 16;
> > +
> > +#ifdef CONFIG_64BIT
> > +	qc |= qc << 32;
> > +#endif
> 
> Could be 'qc *= -1ul / 0xff;'

	qc *= ~0ul / 0xff;

would be slightly better.

	David

> 
> 
> r~

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.