aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-utils.stanza
diff options
context:
space:
mode:
authorazidar2015-08-26 15:07:12 -0700
committerazidar2015-08-26 15:07:53 -0700
commitb6bf5ee9b29a117c1fcb3b7ec19ce1ce07132ffd (patch)
treec65e8d722c77fbbaa42c4b3d98e3d0ba6cdb9fca /src/main/stanza/ir-utils.stanza
parentcf1fe102a99efee192288061849165072c699c2e (diff)
Fixed bug where firrtl was incorrectly judging the width of a bigint. #36 #37.
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
-rw-r--r--src/main/stanza/ir-utils.stanza8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index 0c3140ed..a234ff81 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -500,6 +500,14 @@ public defn merge!<?K,?V> (a:HashTable<?K,?V>, b:HashTable<K,V>) :
for e in b do :
a[key(e)] = value(e)
+public defn pow (x:Int,y:Int) -> Int :
+ var x* = 1
+ var y* = y
+ while y* != 0 :
+ x* = times(x*,x)
+ y* = minus(y*,1)
+ x*
+
public defn pow (x:Long,y:Long) -> Long :
var x* = to-long(1)
var y* = y