projects
/
yosys.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Merge remote-tracking branch 'origin/eddie/shregmap_improve' into xc7mux"
[yosys.git]
/
kernel
/
yosys.cc
diff --git
a/kernel/yosys.cc
b/kernel/yosys.cc
index 20d972150a978239ae96731ef5622b47929a488a..377572fc2984243a2ede59d2e35af34a7fa27b8d 100644
(file)
--- a/
kernel/yosys.cc
+++ b/
kernel/yosys.cc
@@
-151,14
+151,16
@@
void yosys_banner()
int ceil_log2(int x)
{
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;
if (x <= 0)
return 0;
-
for (int i = 0; i < 32; i++)
if (((x-1) >> i) == 0)
return i;
for (int i = 0; i < 32; i++)
if (((x-1) >> i) == 0)
return i;
-
log_abort();
log_abort();
+#endif
}
std::string stringf(const char *fmt, ...)
}
std::string stringf(const char *fmt, ...)