On Sun, 2009-11-15 at 16:12 -0700, David Brownell wrote:
> On Sunday 15 November 2009, Zach Welch wrote:
> > > 
> > > Or maybe I was.  Given that it copies everything, why
> > > is there code *after* the copy mangling the last byte?
> > > Wouldn't that only be correct when the code copied
> > > all but the trailing partial byte?
> > 
> > It masks the last byte, ensuring any trailing bits are 0.
> > Without it, the bits after the 'trailing' will have been copied beyond
> > the bits intended: copy buf=0xff, len=3 should give 0x07 and not 0xff.
> > Right?  That's what the old code did, in a really confusing manner.
> 
> Chalk it up to a flakey model for handling bitfields, then.
> 
> My model is that if I've got a buffer, and am told to
> stuff N bits into it at a particular location, then
> only N bits will change.
> 
> Instead, we seem to change N ... then zero up to seven
> bits in the last byte.

Hey... I'm not defending it! :)  Further changes can come after this
series has been pushed, when we can audit all of its callers.  I expect
many opportunities for optimization as we move up the stack.

--Z
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to