Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
82fdabda
Commit
82fdabda
authored
Jan 13, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlc_common: add ctz() to count trailing zeroes
parent
c5d9ac73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
include/vlc_common.h
include/vlc_common.h
+19
-1
No files found.
include/vlc_common.h
View file @
82fdabda
...
@@ -524,7 +524,7 @@ static inline unsigned clz (unsigned x)
...
@@ -524,7 +524,7 @@ static inline unsigned clz (unsigned x)
while
(
x
)
while
(
x
)
{
{
x
=
x
>>
1
;
x
>>=
1
;
i
--
;
i
--
;
}
}
return
i
;
return
i
;
...
@@ -536,6 +536,24 @@ static inline unsigned clz (unsigned x)
...
@@ -536,6 +536,24 @@ static inline unsigned clz (unsigned x)
/* XXX: this assumes that int is 32-bits or more */
/* XXX: this assumes that int is 32-bits or more */
#define clz32( x ) (clz(x) - ((sizeof(unsigned) - sizeof (uint32_t)) * 8))
#define clz32( x ) (clz(x) - ((sizeof(unsigned) - sizeof (uint32_t)) * 8))
/** Count trailing zeroes */
VLC_USED
static
inline
unsigned
ctz
(
unsigned
x
)
{
#if VLC_GCC_VERSION(3,4)
return
__builtin_ctz
(
x
);
#else
unsigned
i
=
sizeof
(
x
)
*
8
;
while
(
x
)
{
x
<<=
1
;
i
--
;
}
return
i
;
#endif
}
/** Bit weight */
/** Bit weight */
VLC_USED
VLC_USED
static
inline
unsigned
popcount
(
unsigned
x
)
static
inline
unsigned
popcount
(
unsigned
x
)
...
...
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