aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/util.h')
-rw-r--r--tools/perf/util/util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 0128906bac8..37be34dff79 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -245,4 +245,15 @@ int readn(int fd, void *buf, size_t size);
245#define _STR(x) #x 245#define _STR(x) #x
246#define STR(x) _STR(x) 246#define STR(x) _STR(x)
247 247
248/*
249 * Determine whether some value is a power of two, where zero is
250 * *not* considered a power of two.
251 */
252
253static inline __attribute__((const))
254bool is_power_of_2(unsigned long n)
255{
256 return (n != 0 && ((n & (n - 1)) == 0));
257}
258
248#endif 259#endif