/* Now upgrade the permitted caps we still kept to effective caps */
if (keep_capabilities != 0) {
- cap_value_t bits[u64log2(keep_capabilities) + 1];
+ cap_value_t bits[log2u64(keep_capabilities) + 1];
_cleanup_cap_free_ cap_t d = NULL;
unsigned i, j = 0;
int on_ac_power(void);
-static inline unsigned u64log2(uint64_t n) {
+static inline unsigned log2u64(uint64_t n) {
#if __SIZEOF_LONG_LONG__ == 8
return (n > 1) ? (unsigned) __builtin_clzll(n) ^ 63U : 0;
#else
this_run = now(CLOCK_MONOTONIC);
- l = u64log2(this_run - e->last_run_usec);
+ l = log2u64(this_run - e->last_run_usec);
assert(l < ELEMENTSOF(e->delays));
e->delays[l]++;
#include "tests.h"
#include "util.h"
-TEST(u64log2) {
- assert_se(u64log2(0) == 0);
- assert_se(u64log2(8) == 3);
- assert_se(u64log2(9) == 3);
- assert_se(u64log2(15) == 3);
- assert_se(u64log2(16) == 4);
- assert_se(u64log2(1024*1024) == 20);
- assert_se(u64log2(1024*1024+5) == 20);
+TEST(log2u64) {
+ assert_se(log2u64(0) == 0);
+ assert_se(log2u64(8) == 3);
+ assert_se(log2u64(9) == 3);
+ assert_se(log2u64(15) == 3);
+ assert_se(log2u64(16) == 4);
+ assert_se(log2u64(1024*1024) == 20);
+ assert_se(log2u64(1024*1024+5) == 20);
}
TEST(protect_errno) {