Skip to content

Commit

Permalink
Implement byte-to-char casts for crucible-mir.
Browse files Browse the repository at this point in the history
  • Loading branch information
sauclovian-g committed Mar 27, 2024
1 parent e03b20f commit 9fce599
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crucible-mir/src/Mir/Trans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,15 @@ evalCast' ck ty1 e ty2 = do
-> baseSizeToNatCont bsz $ \w ->
return $ MirExp (C.BVRepr w) (R.App $ E.BVIte e0 w (R.App $ eBVLit w 1) (R.App $ eBVLit w 0))

-- char to uint
-- char to usize
(M.Misc, M.TyChar, M.TyUint M.USize)
| MirExp (C.BVRepr sz) e0 <- e
-> return $ MirExp UsizeRepr (bvToUsize sz R.App e0)
-- char to other uint
(M.Misc, M.TyChar, M.TyUint s) -> baseSizeToNatCont s $ extendUnsignedBV e

-- byte to char
(M.Misc, M.TyUint B8, M.TyChar) -> baseSizeToNatCont M.B32 $ extendUnsignedBV e



Expand Down

0 comments on commit 9fce599

Please sign in to comment.