Skip to content
Snippets Groups Projects
Commit ed753853 authored by Sapphie's avatar Sapphie
Browse files

Implement int shift primitives

parent 4ff877f5
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,27 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
}
}
}
// I don't think there is a way to do this in a smart way
case L3.IntDiv => ???
case L3.IntMod => ???
case L3.IntShiftLeft =>
tempLetP(CPS.Sub, Seq(Left(x), lAtomOne)) { x1 =>
tempLetP(CPS.ShiftRight, Seq(Left(y), lAtomOne)) { y1 =>
tempLetP(CPS.ShiftLeft, Seq(Right(x1), Right(y1))) { z =>
L.LetP(n, CPS.Add, Seq(z, L.AtomL(1)), apply(body))
}
}
}
case L3.IntShiftRight =>
tempLetP(CPS.ShiftRight, Seq(Left(y), lAtomOne)) { y1 =>
tempLetP(CPS.ShiftRight, Seq(Left(x), Right(y1))) { z =>
L.LetP(n, CPS.Add, Seq(z, L.AtomL(1)), apply(body))
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment