projects
/
yosys.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7d01490
)
Provide an integer implementation of decimal_digits().
author
Henner Zeller
<h.zeller@acm.org>
Mon, 1 Feb 2021 19:23:44 +0000
(11:23 -0800)
committer
Henner Zeller
<h.zeller@acm.org>
Mon, 1 Feb 2021 19:23:44 +0000
(11:23 -0800)
Signed-off-by: Henner Zeller <h.zeller@acm.org>
frontends/aiger/aigerparse.cc
patch
|
blob
|
history
diff --git
a/frontends/aiger/aigerparse.cc
b/frontends/aiger/aigerparse.cc
index 2d7c2187e2f3fb1e8ebe71a6d1cae8077713d7d3..463c5965b941d1e1ec166b87cd760f9ab84a73bd 100644
(file)
--- a/
frontends/aiger/aigerparse.cc
+++ b/
frontends/aiger/aigerparse.cc
@@
-55,8
+55,15
@@
inline int32_t from_big_endian(int32_t i32) {
#define log_debug2(...) ;
//#define log_debug2(...) log_debug(__VA_ARGS__)
-static int decimal_digits(unsigned n) {
- return n > 1 ? ceil(log10(n)) : 1;
+static int decimal_digits(uint32_t n) {
+ static uint32_t digit_cutoff[9] = {
+ 10, 100, 1000, 10000, 100000,
+ 1000000, 10000000, 100000000, 1000000000
+ };
+ for (int i = 0; i < 9; ++i) {
+ if (n < digit_cutoff[i]) return i + 1;
+ }
+ return 10;
}
struct ConstEvalAig