Commit bb294cde authored by Kunshan Wang's avatar Kunshan Wang

MemoryOperations fix and refactor

Lifted xxxEntity outside match.

Fixed a bug in MemorySupport.cmpXchgEntity
parent 0bb90c20
......@@ -157,7 +157,7 @@ class MemorySupport(val muMemorySize: Word) {
def cmpXchgEntity[T: CanBeIntegerized](addr: Word, expected: Option[T], desired: Option[T])(
implicit microVM: MicroVM): (Boolean, Option[T]) = {
val numExpected = implicitly[CanBeIntegerized[T]].integerize(expected)
val numDesired = implicitly[CanBeIntegerized[T]].integerize(expected)
val numDesired = implicitly[CanBeIntegerized[T]].integerize(desired)
val (succ, oldNum) = cmpXchgLong(addr, numExpected, numDesired, inMu = true)
val oldObj = try {
implicitly[CanBeIntegerized[T]].deIntegerize(oldNum)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment