bus: skip useless iterations in find function
authorGaetan Rivet <gaetan.rivet@6wind.com>
Tue, 29 Aug 2017 16:19:48 +0000 (18:19 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 25 Oct 2017 11:12:36 +0000 (13:12 +0200)
commit96d9dd74cde0ba14ec99c806ab25ff9b992c58d6
tree52170ce3b5f90e0a3338ff6c2cbedcc637b5b923
parent681459bf9cd5778ada011e6d8d681436ec5394f0
bus: skip useless iterations in find function

The starting point is known. The iterator can be directly set to it.

The function rte_bus_find can easily be used with a comparison function
always returning True. This would make it a regular bus iterator.

Users doing so would however accomplish such iteration in

   O(N * N/2) = O(N^2)

Which can be avoided.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_eal/common/eal_common_bus.c