1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix issues with villas::utils namespace

This commit is contained in:
Steffen Vogel 2019-06-03 18:11:03 +02:00
parent 85c4c36244
commit 6887e653c5
2 changed files with 9 additions and 7 deletions

View file

@ -82,7 +82,7 @@
#define CEIL(x, y) (((x) + (y) - 1) / (y))
/** Get nearest up-rounded power of 2 */
#define LOG2_CEIL(x) (1 << (log2i((x) - 1) + 1))
#define LOG2_CEIL(x) (1 << (villas::utils::log2i((x) - 1) + 1))
/** Check if the number is a power of 2 */
#define IS_POW2(x) (((x) != 0) && !((x) & ((x) - 1)))
@ -186,12 +186,7 @@ void * memdup(const void *src, size_t bytes);
void die();
/** Get log2 of long long integers */
static inline int log2i(long long x) {
if (x == 0)
return 1;
return sizeof(x) * 8 - __builtin_clzll(x) - 1;
}
int log2i(long long x);
/** Send signal \p sig to main thread. */
void killme(int sig);

View file

@ -331,6 +331,13 @@ size_t strlenp(const char *str)
return sz;
}
int log2i(long long x) {
if (x == 0)
return 1;
return sizeof(x) * 8 - __builtin_clzll(x) - 1;
}
int sha1sum(FILE *f, unsigned char *sha1)
{
SHA_CTX c;