Date: Wed, 20 Jun 2012 11:41:01 +0400 From: Gennady Proskurin <gprspb@mail.ru> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: svn-src-head@freebsd.org, Daniel O'Connor <doconnor@gsoft.com.au>, Gennady Proskurin <gprspb@mail.ru>, src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r237223 - head/sys/dev/fb Message-ID: <20120620074101.GA832@gpr.nnz-home.ru> In-Reply-To: <31750.1340083631@critter.freebsd.dk> References: <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au> <31750.1340083631@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
--45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 19, 2012 at 05:27:11AM +0000, Poul-Henning Kamp wrote: > In message <68FBE843-7337-4C90-B01F-E0CAABB62BCD@gsoft.com.au>, "Daniel O'Conno > r" writes: > > >> If size is odd, this does not copy the last byte. Not sure, whether = > >this is intended. > > Feel free to improve... --45Z9DzgjV8m4Oswq Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fb.patch" Index: fbreg.h =================================================================== --- fbreg.h (revision 237289) +++ fbreg.h (working copy) @@ -39,9 +39,12 @@ static __inline void copyw(uint16_t *src, uint16_t *dst, size_t size) { + const int is_odd = (size & 0x1); size >>= 1; while (size--) *dst++ = *src++; + if (is_odd) + *(char*)dst = *(char*)src; // copy last byte } #define bcopy_io(s, d, c) copyw((void*)(s), (void*)(d), (c)) #define bcopy_toio(s, d, c) copyw((void*)(s), (void*)(d), (c)) --45Z9DzgjV8m4Oswq--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120620074101.GA832>