Skip to content

Commit 3f5adfa

Browse files
author
Oron Port
committed
just summonInline DFCG instead of the onDemand mechanism for min/max operations
1 parent f9f080e commit 3f5adfa

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

core/src/main/scala/dfhdl/core/DFC.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ object DFC:
120120
def empty(eo: ElaborationOptions): DFC =
121121
DFC(None, Position.unknown, None, elaborationOptionsContr = () => eo)
122122
def emptyNoEO: DFC = DFC(None, Position.unknown, None)
123-
inline def onDemand: DFC =
124-
compiletime.summonFrom {
125-
case dfc: DFC => dfc
126-
case _ => emptyNoEO
127-
}
128123
sealed trait Scope
129124
object Scope:
130125
sealed trait Global extends Scope

core/src/main/scala/dfhdl/core/DFVal.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,13 +1217,19 @@ object DFVal extends DFValLP:
12171217
case (lhs: Int, rhs: Int) => scala.runtime.RichInt(lhs) max rhs
12181218
case (lhs: Long, rhs: Long) => scala.runtime.RichLong(lhs) max rhs
12191219
case (lhs: Double, rhs: Double) => scala.runtime.RichDouble(lhs) max rhs
1220-
case _ => exactOp2[FuncOp.max.type, DFC, DFValAny](lhs, rhs)(using DFC.onDemand)
1220+
case _ =>
1221+
exactOp2[FuncOp.max.type, DFC, DFValAny](lhs, rhs)(using
1222+
compiletime.summonInline[DFCG]
1223+
)
12211224
transparent inline def min(inline rhs: SupportedValue): Any =
12221225
inline (lhs, rhs) match
12231226
case (lhs: Int, rhs: Int) => scala.runtime.RichInt(lhs) min rhs
12241227
case (lhs: Long, rhs: Long) => scala.runtime.RichLong(lhs) min rhs
12251228
case (lhs: Double, rhs: Double) => scala.runtime.RichDouble(lhs) min rhs
1226-
case _ => exactOp2[FuncOp.min.type, DFC, DFValAny](lhs, rhs)(using DFC.onDemand)
1229+
case _ =>
1230+
exactOp2[FuncOp.min.type, DFC, DFValAny](lhs, rhs)(using
1231+
compiletime.summonInline[DFCG]
1232+
)
12271233
end extension
12281234
extension (inline lhs: SupportedValue)
12291235
transparent inline def as(inline aliasType: DFType.Supported)(using DFCG): DFValAny =

0 commit comments

Comments
 (0)