This commit is contained in:
HailoRT-Automation
2023-06-29 15:02:42 +03:00
committed by GitHub
parent 86bb9c4968
commit 9bce73eb42
377 changed files with 17950 additions and 8664 deletions

View File

@@ -10,6 +10,8 @@
#ifndef __UTILS_H__
#define __UTILS_H__
#include <stdint.h>
/** A compile time assertion check.
*
* Validate at compile time that the predicate is true without
@@ -125,4 +127,20 @@ _PP_ISEMPTY( \
#define MICROSECONDS_IN_MILLISECOND (1000)
static inline uint8_t ceil_log2(uint32_t n)
{
uint8_t result = 0;
if (n <= 1) {
return 0;
}
while (n > 1) {
result++;
n = (n + 1) >> 1;
}
return result;
}
#endif /* __UTILS_H__ */