3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 22:23:23 +00:00

io: refactor string and file work into new unit

This commit is contained in:
Emil J. Tywoniak 2024-12-11 15:35:43 +01:00
parent 0c689091e2
commit 4f3fdc8457
17 changed files with 595 additions and 523 deletions

View file

@ -262,6 +262,20 @@ struct arrow_proxy {
T* operator->() { return &v; }
};
inline int ceil_log2(int x)
{
#if defined(__GNUC__)
return x > 1 ? (8*sizeof(int)) - __builtin_clz(x-1) : 0;
#else
if (x <= 0)
return 0;
for (int i = 0; i < 32; i++)
if (((x-1) >> i) == 0)
return i;
log_abort();
#endif
}
YOSYS_NAMESPACE_END
#endif