From: Eric Blake Date: Fri, 15 Jul 2011 21:49:37 +0000 (-0600) Subject: virsh: use faster bit search X-Git-Tag: v0.9.4-rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e853d6c1a0ec58d519419e2348d5c6999062089;p=thirdparty%2Flibvirt.git virsh: use faster bit search Now that gnulib gives us ffs, we might as well use it. * tools/virsh.c (vshCmddefGetData): Use ffs rather than count_one_bits. --- diff --git a/tools/virsh.c b/tools/virsh.c index ad0a2c3f97..f2fd9e550d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -57,7 +58,6 @@ #include "configmake.h" #include "threads.h" #include "command.h" -#include "count-one-bits.h" #include "virkeycode.h" static char *progname; @@ -12852,7 +12852,7 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg, return NULL; /* Grab least-significant set bit */ - i = count_one_bits(*opts_need_arg ^ (*opts_need_arg - 1)) - 1; + i = ffs(*opts_need_arg) - 1; opt = &cmd->opts[i]; if (opt->type != VSH_OT_ARGV) *opts_need_arg &= ~(1 << i);