Skip to content

Commit 0ef8849

Browse files
committed
Optimize divisions and remainders by constants.
Following the techniques described in Hacker's Delight, Chapter 10.
1 parent 289a5e1 commit 0ef8849

File tree

7 files changed

+1387
-8
lines changed

7 files changed

+1387
-8
lines changed

ir/shared/src/main/scala/org/scalajs/ir/Trees.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ object Trees {
125125

126126
override def toString(): String =
127127
stats.mkString("Block(", ",", ")")
128+
129+
override def equals(that: Any): Boolean = that match {
130+
case that: Block => this.stats == that.stats
131+
case _ => false
132+
}
133+
134+
override def hashCode(): Int = stats.##
128135
}
129136

130137
object Block {

0 commit comments

Comments
 (0)