diplomacy: add x"..." string context
Enables hex address literals containing underscores. Converts them to BigInts.
This commit is contained in:
parent
063ca0ed4a
commit
37c5af1c0d
@ -22,6 +22,13 @@ package object diplomacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
implicit class BigIntHexContext(val sc: StringContext) extends AnyVal {
|
||||||
|
def x(args: Any*): BigInt = {
|
||||||
|
val orig = sc.s(args: _*)
|
||||||
|
BigInt(orig.replace("_", ""), 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def SinkCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
|
def SinkCardinality[T](body: Parameters => T)(implicit p: Parameters) = body(p.alterPartial {
|
||||||
case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SINK_TO_SOURCE
|
case CardinalityInferenceDirectionKey => CardinalityInferenceDirection.SINK_TO_SOURCE
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user