aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/aiger
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/aiger')
-rw-r--r--frontends/aiger/aigerparse.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc
index 2d7c2187e..463c5965b 100644
--- 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