Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xcap
xcap-capability-linux
Commits
0a8a2226
Commit
0a8a2226
authored
Nov 21, 2018
by
Vikram Narayanan
Browse files
Get rid of log2_NaN()
parent
7847ab98
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/linux/log2.h
View file @
0a8a2226
...
...
@@ -15,12 +15,6 @@
#include
<linux/types.h>
#include
<linux/bitops.h>
/*
* deal with unrepresentable constant logarithms
*/
extern
__attribute__
((
const
,
noreturn
))
int
____ilog2_NaN
(
void
);
/*
* non-constant log of base 2 calculators
* - the arch may override these in asm/bitops.h if they can be implemented
...
...
@@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
#define ilog2(n) \
( \
__builtin_constant_p(n) ? ( \
(n) <
1
?
____ilog2_NaN()
: \
(n) <
2
?
0
: \
(n) & (1ULL << 63) ? 63 : \
(n) & (1ULL << 62) ? 62 : \
(n) & (1ULL << 61) ? 61 : \
...
...
@@ -148,9 +142,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
(n) & (1ULL << 4) ? 4 : \
(n) & (1ULL << 3) ? 3 : \
(n) & (1ULL << 2) ? 2 : \
(n) & (1ULL << 1) ? 1 : \
(n) & (1ULL << 0) ? 0 : \
____ilog2_NaN() \
1 \
) : \
(sizeof(n) <= 4) ? \
__ilog2_u32(n) : \
...
...
tools/include/linux/log2.h
View file @
0a8a2226
...
...
@@ -12,12 +12,6 @@
#ifndef _TOOLS_LINUX_LOG2_H
#define _TOOLS_LINUX_LOG2_H
/*
* deal with unrepresentable constant logarithms
*/
extern
__attribute__
((
const
,
noreturn
))
int
____ilog2_NaN
(
void
);
/*
* non-constant log of base 2 calculators
* - the arch may override these in asm/bitops.h if they can be implemented
...
...
@@ -78,7 +72,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
#define ilog2(n) \
( \
__builtin_constant_p(n) ? ( \
(n) <
1
?
____ilog2_NaN()
: \
(n) <
2
?
0
: \
(n) & (1ULL << 63) ? 63 : \
(n) & (1ULL << 62) ? 62 : \
(n) & (1ULL << 61) ? 61 : \
...
...
@@ -141,9 +135,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
(n) & (1ULL << 4) ? 4 : \
(n) & (1ULL << 3) ? 3 : \
(n) & (1ULL << 2) ? 2 : \
(n) & (1ULL << 1) ? 1 : \
(n) & (1ULL << 0) ? 0 : \
____ilog2_NaN() \
1 \
) : \
(sizeof(n) <= 4) ? \
__ilog2_u32(n) : \
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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