diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-06-13 20:59:15 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-06-13 20:59:15 +0000 |
commit | fca19e7635df53bf636d6d45c1bc6b610617690c (patch) | |
tree | cbe430cf815888e54ca03d695d90c0080af272a0 /channels/chan_agent.c | |
parent | a6d0d0414163662ee4a2c3b6a1e8915ccded6ee5 (diff) |
use a compiler builtin (which uses processor instructions) for this operation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@33933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r-- | channels/chan_agent.c | 11 |
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; } |