mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-07 06:09:13 -04:00
libutils: make ceiling_log2() inline
This commit is contained in:
parent
d8694268a6
commit
0079634a08
@ -40,11 +40,6 @@ uint64_t clp2(uint64_t x)
|
|||||||
return x + 1;
|
return x + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ceiling_log2(uint64_t x)
|
|
||||||
{
|
|
||||||
return ilog2(clp2(x));
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *adjust_unit(double *ptr_bytes)
|
const char *adjust_unit(double *ptr_bytes)
|
||||||
{
|
{
|
||||||
const char *units[] = { "Byte", "KB", "MB", "GB", "TB", "PB", "EB" };
|
const char *units[] = { "Byte", "KB", "MB", "GB", "TB", "PB", "EB" };
|
||||||
|
@ -12,7 +12,10 @@ int ilog2(uint64_t x);
|
|||||||
/* Least power of 2 greater than or equal to x. */
|
/* Least power of 2 greater than or equal to x. */
|
||||||
uint64_t clp2(uint64_t x);
|
uint64_t clp2(uint64_t x);
|
||||||
|
|
||||||
int ceiling_log2(uint64_t x);
|
static inline int ceiling_log2(uint64_t x)
|
||||||
|
{
|
||||||
|
return ilog2(clp2(x));
|
||||||
|
}
|
||||||
|
|
||||||
const char *adjust_unit(double *ptr_bytes);
|
const char *adjust_unit(double *ptr_bytes);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user