From 7e853d6c1a0ec58d519419e2348d5c6999062089 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 15 Jul 2011 15:49:37 -0600 Subject: [PATCH] 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. --- tools/virsh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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);