On Wed, Oct 18, 2006 at 07:30:40AM -0400, Adam Kropelin wrote:
> Grant Grundler wrote:
> >The test code didn't attempt to correct for endianess...so the bytes
> >are backwards on gsyprf11. But 32-bit extract fails for offsets
> >1-7 like I expected.
> 
> 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.

It's not a 32/64 bit difference, it's a big/little endian problem.

> Am I the only one who thinks...
>    offset &= 8 - 1;
> ...is less clear than...
>    offset &= 7;
> ...?

I agree that &= 7 is clearer.  I always worry about operator precedence.

> 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 think %8 is different for signed types ... anyway, & 7 is perfectly
clear, particularly when we really are working with bits.

> 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 don't know the USB stack, but you're pretty unlikely to hit anything
when reading an aligned u64.  Almost everything is padded to at least
that boundary.

By the way, Linus' tree now has Grant's implementation of
extract/implement, so it'll be easiest for Greg if you generate patches
against that version rather than against what was in 2.6.19-rc2.

-------------------------------------------------------------------------
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

Reply via email to