Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
6c6ac9cb
Commit
6c6ac9cb
authored
Oct 28, 2015
by
Matt Oliver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/x86/intmath: Use tzcnt in place of bsf.
Signed-off-by:
Matt Oliver
<
protogonoi@gmail.com
>
parent
e82883aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
39 deletions
+15
-39
intmath.h
libavutil/x86/intmath.h
+15
-39
No files found.
libavutil/x86/intmath.h
View file @
6c6ac9cb
...
...
@@ -25,55 +25,31 @@
#include "config.h"
#if HAVE_FAST_CLZ
#if defined(__INTEL_COMPILER)
# define ff_log2(x) (_bit_scan_reverse((x)|1))
# define ff_log2_16bit av_log2
# define ff_ctz(v) _bit_scan_forward(v)
# define ff_ctzll ff_ctzll_x86
static
av_always_inline
av_const
int
ff_ctzll_x86
(
long
long
v
)
{
# if ARCH_X86_64
uint64_t
c
;
__asm__
(
"bsfq %1,%0"
:
"=r"
(
c
)
:
"r"
(
v
));
return
c
;
#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
# if defined(__INTEL_COMPILER)
# define ff_log2(x) (_bit_scan_reverse((x)|1))
# else
return
((
uint32_t
)
v
==
0
)
?
_bit_scan_forward
((
uint32_t
)(
v
>>
32
))
+
32
:
_bit_scan_forward
((
uint32_t
)
v
);
# endif
}
#elif defined(_MSC_VER)
# define ff_log2 ff_log2_x86
static
av_always_inline
av_const
int
ff_log2_x86
(
unsigned
int
v
)
{
# define ff_log2 ff_log2_x86
static
av_always_inline
av_const
int
ff_log2_x86
(
unsigned
int
v
)
{
unsigned
long
n
;
_BitScanReverse
(
&
n
,
v
|
1
);
_BitScanReverse
(
&
n
,
v
|
1
);
return
n
;
}
# endif
# define ff_log2_16bit av_log2
# define ff_ctz ff_ctz_x86
static
av_always_inline
av_const
int
ff_ctz_x86
(
int
v
)
{
unsigned
long
c
;
_BitScanForward
(
&
c
,
v
);
return
c
;
}
# define ff_ctz(v) _tzcnt_u32(v)
# define ff_ctzll ff_ctzll_x86
static
av_always_inline
av_const
int
ff_ctzll_x86
(
long
long
v
)
{
unsigned
long
c
;
# if ARCH_X86_64
_BitScanForward64
(
&
c
,
v
);
# define ff_ctzll(v) _tzcnt_u64(v)
# else
if
((
uint32_t
)
v
==
0
)
{
_BitScanForward
(
&
c
,
(
uint32_t
)(
v
>>
32
));
c
+=
32
;
}
else
{
_BitScanForward
(
&
c
,
(
uint32_t
)
v
);
}
# endif
return
c
;
# define ff_ctzll ff_ctzll_x86
static
av_always_inline
av_const
int
ff_ctzll_x86
(
long
long
v
)
{
return
((
uint32_t
)
v
==
0
)
?
_tzcnt_u32
((
uint32_t
)(
v
>>
32
))
+
32
:
_tzcnt_u32
((
uint32_t
)
v
);
}
# endif
#endif
/* __INTEL_COMPILER */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment