Ejemplo n.º 1
0
 /// <summary>
 /// Fits a bit vector expression into a bit vector with size,
 /// either by truncating or zero padding.
 /// </summary>
 public static Z3BVExpr FitBV(this Z3BVExpr expr1, Z3Context context, uint size)
 {
     Contract.Requires(expr1 != null && context != null && size > 0);
     if (expr1.SortSize == size)
     {
         return(expr1);
     }
     else if (expr1.SortSize < size)
     {
         return(context.MkZeroExt(size - expr1.SortSize, expr1));
     }
     else
     {
         return(context.MkExtract(size - 1, 0, expr1));
     }
 }