Asterisk - The Open Source Telephony Project
18.5.0
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Functions
b
c
d
e
f
g
i
l
m
n
p
r
s
t
u
v
w
+
Variables
a
b
c
d
e
f
i
l
m
n
o
p
q
r
s
t
w
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
Properties
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
+
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Modules
Pages
codecs
log2comp.h
Go to the documentation of this file.
1
/*! \file
2
* \brief log2comp.h - various base 2 log computation versions
3
*
4
* Asterisk -- An open source telephony toolkit.
5
*
6
* \author Alex Volkov <codepro@usa.net>
7
*
8
* Copyright (c) 2004 - 2005, Digium Inc.
9
*
10
* This program is free software, distributed under the terms of
11
* the GNU General Public License
12
*
13
* Define WANT_ASM before including this file to use assembly
14
* whenever possible
15
*/
16
17
#if defined(_MSC_VER)
18
# define inline __inline
19
#elif defined(__GNUC__)
20
# define inline __inline__
21
#else
22
# define inline
23
#endif
24
25
#if defined(WANT_ASM) && defined(_MSC_VER) && defined(_M_IX86)
26
/* MS C Inline Asm */
27
# pragma warning( disable : 4035 )
28
static
inline
int
ilog2
(
int
val
) { __asm
29
{
30
xor eax, eax
31
dec eax
32
bsr eax, val
33
}}
34
# pragma warning( default : 4035 )
35
#elif defined(WANT_ASM) && defined(__GNUC__) && (defined(__i386__) || defined(i386))
36
/* GNU Inline Asm */
37
static
inline
int
ilog2
(
int
val
)
38
{
39
int
a
;
40
__asm__
41
(
"\
42
xorl %0, %0 ;\
43
decl %0 ;\
44
bsrl %1, %0 ;\
45
"
46
:
"=&r"
(a)
47
:
"mr"
(val)
48
:
"cc"
49
);
50
return
a
;
51
}
52
#elif defined(WANT_ASM) && defined(__GNUC__) && defined(__powerpc__)
53
static
inline
int
ilog2
(
int
val
)
54
{
55
int
a
;
56
__asm__ (
"cntlzw %0,%1"
57
:
"=r"
(a)
58
:
"r"
(val)
59
);
60
return
31-
a
;
61
}
62
#else
63
/* no ASM for this compiler and/or platform */
64
/* rather slow base 2 log computation
65
* Using looped shift.
66
*/
67
static
inline
int
ilog2
(
int
val
)
68
{
69
int
i;
70
for
(i = -1; val; ++i, val >>= 1)
71
;
72
return
(i);
73
}
74
#endif
val
Definition:
ast_expr2.c:325
ilog2
static int ilog2(int val)
Definition:
log2comp.h:67
a
static struct test_val a
Definition:
test_linkedlists.c:46
Generated on Sun Aug 8 2021 19:43:51 for Asterisk - The Open Source Telephony Project by
1.8.13