correctly compute sw_trace_nd

Also, remove if test in sw_trace to gain alittle bit of performance. In addition, the documentation for these sections is updated accordingly.