[haiku-bugs] Re: [Haiku] #8954: USB3 support

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Mon, 25 Aug 2014 06:33:56 -0000

#8954: USB3 support
---------------------------+----------------------------
   Reporter:  dsjonny      |      Owner:  korli
       Type:  enhancement  |     Status:  assigned
   Priority:  high         |  Milestone:  Unscheduled
  Component:  Drivers/USB  |    Version:  R1/Development
 Resolution:               |   Keywords:  usb3
 Blocked By:               |   Blocking:  7665, 10750
Has a Patch:  1            |   Platform:  All
---------------------------+----------------------------

Comment (by pulkomandy):

 Always prefer clarity over shortness. The compiler will optimize :)

 Style issues I could see:
 dont write:
 {{{
 if (foo)
 {
 }}}

 do write:
 {{{
 if (foo) {
 }}}

 (same for while, for, switch)

 When the body of an if or while is single line, don't add braces.

 Your computation of calcInterval from interval sounds inefficient. I think
 you want the log2 of interval*8 (or log2 of interval + 3), which can be
 computed in several more efficient ways:
 https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious

 Since such bit operations are sometimes unclear, you may want to extract
 this to a separate function with an appropriate name (int_log2 maybe?)and
 comments on where the algorithm comes from if using the non-obvious way.
 We may already have some functions like this in headers/private/shared.

--
Ticket URL: <https://dev.haiku-os.org/ticket/8954#comment:61>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: