@@ -532,7 +532,7 @@ trait Expressions { self: Trees =>
532
532
533
533
/** $encodingof `... .toByte` and other narrowing casts */
534
534
sealed case class BVNarrowingCast (expr : Expr , newType : BVType ) extends Expr with CachingTyped {
535
- // The expression is well types iff `expr` is well typed and the BVTypes' size match a narrowing cast.
535
+ // The expression is well typed iff `expr` is well typed and the BVTypes' size match a narrowing cast.
536
536
override protected def computeType (implicit s : Symbols ): Type = cast match {
537
537
case Some ((from, to)) => newType
538
538
case _ => Untyped
@@ -547,7 +547,7 @@ trait Expressions { self: Trees =>
547
547
548
548
/** $encodingof `... .toInt` and other widening casts */
549
549
sealed case class BVWideningCast (expr : Expr , newType : BVType ) extends Expr with CachingTyped {
550
- // The expression is well types iff `expr` is well typed and the BVTypes' size match a widening cast.
550
+ // The expression is well typed iff `expr` is well typed and the BVTypes' size match a widening cast.
551
551
override protected def computeType (implicit s : Symbols ): Type = cast match {
552
552
case Some ((from, to)) => newType
553
553
case _ => Untyped
@@ -560,6 +560,22 @@ trait Expressions { self: Trees =>
560
560
}
561
561
}
562
562
563
+ /** Bitvector conversion from unsigned to signed */
564
+ sealed case class BVUnsignedToSigned (expr : Expr ) extends Expr with CachingTyped {
565
+ override protected def computeType (implicit s : Symbols ): Type = getBVType(expr) match {
566
+ case BVType (false , size) => BVType (true , size)
567
+ case _ => Untyped
568
+ }
569
+ }
570
+
571
+ /** Bitvector conversion from signed to unsigned */
572
+ sealed case class BVSignedToUnsigned (expr : Expr ) extends Expr with CachingTyped {
573
+ override protected def computeType (implicit s : Symbols ): Type = getBVType(expr) match {
574
+ case BVType (true , size) => BVType (false , size)
575
+ case _ => Untyped
576
+ }
577
+ }
578
+
563
579
564
580
/* Tuple operations */
565
581
0 commit comments