Hi Alan,

Em Thu, 3 Aug 2006 11:52:16 -0400 (EDT)
Alan Stern <[EMAIL PROTECTED]> escreveu:

| On Thu, 3 Aug 2006, Luiz Fernando N. Capitulino wrote:
| 
| >  We could do this instead (not compiled!):
| > 
| > static inline int __usb_endpoint_is_in(struct usb_endpoint_descriptor *epd)
| > {
| >     return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
| > }
| > 
| > static inline int __usb_endpoint_is_bulk(struct usb_endpoint_descriptor 
*epd)
| > {
| >     return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 
USB_ENDPOINT_XFER_BULK);
| > }
| > 
| > static inline int usb_endpoint_is_bulk_in(struct usb_endpoint_descriptor 
*epd)
| > {
| >     return (__usb_endpoint_is_bulk(epd) && __usb_endpoint_is_in(epd));
| > }
| > 
| >  But then we'll have to add:
| > 
| > __usb_endpoint_is_in()
| > __usb_endpoint_is_out()
| > __usb_endpoint_is_bulk()
| > __usb_endpoint_is_int()
| > usb_endpoint_is_bulk_in()
| > usb_endpoint_is_bulk_out()
| > usb_endpoint_is_int_in()
| > usb_endpoint_is_int_out()
| > 
| >  Which is flexible, is still good, but looks too much macros to me.
| 
| I think this is a good idea.  Except for one thing: the
| usb_endpoint_is_{bulk/int}_{in/out} macros are approaching the size where
| inline code is more expensive than out-of-line function calls.  You might
| want to consider making those four into exported subroutines instead of
| macros.  Maybe check the object code to see which approach would be 
| smaller.

 Will do, but thinking about this now I remembered that I heard someone
saying that modern GCCs are capable of inlining functions with only
one statament automatically.

 Now I'm considering making all of them real functions...

-- 
Luiz Fernando N. Capitulino

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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