diff options
| author | azidar | 2015-08-19 17:14:15 -0700 |
|---|---|---|
| committer | azidar | 2015-08-19 17:14:15 -0700 |
| commit | be50b579346da77f4e94adc1c1d0f9a492be038e (patch) | |
| tree | 8ecbcbeac57520c6077311f7d0fa8936ef13dd73 /src/main/stanza/ir-utils.stanza | |
| parent | 8eec7cf373bdf02f23164cd7bbf0d02354cbc31f (diff) | |
Switched to new bigint library
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
| -rw-r--r-- | src/main/stanza/ir-utils.stanza | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 3dd0585d..25006659 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -127,6 +127,9 @@ public defn to-int (x:Long) -> Int : if x > to-long(2147483647) or x < to-long(-2147483648) : error("Long too big to convert to Int") else : to-int(to-string(x)) +public defn req-num-bits (i: Int) -> Int : + max(1, ceil-log2(i + 1)) + ;============== PRINTERS =================================== defmethod print (o:OutputStream, d:Flip) : |
