summaryrefslogtreecommitdiff
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 6bbc89cb3..fb77a9456 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -1334,12 +1334,13 @@ static struct ast_channel *agent_request(const char *type, int format, void *dat
return chan;
}
-static int powerof(unsigned int v)
+static force_inline int powerof(unsigned int d)
{
- int x;
- for (x=0;x<32;x++) {
- if (v & (1 << x)) return x;
- }
+ int x = ffs(d);
+
+ if (x)
+ return x - 1;
+
return 0;
}