On Wed, Oct 18, 2006 at 07:30:40AM -0400, Adam Kropelin wrote: > Interesting. I'll fully admit to not having enough 64 bit arch > experience to have predicted that, but that's why I like to unit test > that sort of thing.
Uhm...it has nothing to do with 64-bit arch. We only have a 32-bit user space. It's a basic endian behavior. > >I've rewritten the test to cover a few more cases. > >And I've fixed the algorithm to handle 32-bit extracts in the test > >below and will submit the same code in the next patch. > > Yup, that works fine here, thanks! Excellent. Thanks too! BTW, linus already pulled in the version I had submitted. I'll rebase against that so gregkh can just apply it. > Two other thoughts... > > Am I the only one who thinks... > offset &= 8 - 1; > ...is less clear than... > offset &= 7; > ...? > > When I see "& 7" I think, "Oh, clearly grabbing the 3 LSb". When I see > "& 8-1" I think, "Huh...oh, wait, that's just '& 7'". Alternatively, "% > 8", and let the compiler make the optimization for us. I was originally trying to make it painfully clear that the code deals with a litte endian byte stream. But "&= 7" with short comment "/* mask off bit offset into byte */" would work for me. > Secondly, do we care that in certain cases we'll be dereferncing memory > beyond the end of the user's buffer? We mask it all off, so it doesn't > really matter in the end but it'd sure be unpleasant if we hit a fault > or a hw register or something. Too unlikely to care about or downright > impossible? I thought about this last night and before too. It's a don't care. The code has always done this - even before 2.6.12-rc5. x86 will never crash because of this. parisc and ia64 would. But it would have to be the last word on the last physical page of a contiguous chunk of RAM. thanks, grant ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel