Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero extension expression #8442

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

zero extension expression #8442

wants to merge 2 commits into from

Commits on Sep 5, 2024

  1. introduce zero_expr() and one_expr() for number types

    This adds ::zero_expr() and ::one_expr() for integers, natural numbers,
    rationals and reals.
    kroening committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    d146817 View commit details
    Browse the repository at this point in the history
  2. introduce zero_extend expression

    This introduces the zero_extend expression, which, given a bit-vector
    operand and a type, either
    
    a) pads the given operand with zeros from the left if the given type is
    wider than the type of the operand, or
    
    b) truncates the operand to the width of the given type if the given type is
    smaller than the operand, or
    
    c) reinterprets the operand as having the given type if the width of the
    type and the width of the operand match.  This may differ from conversion if
    the types have different bit representations.
    
    This is easier to read and less prone to error than the current pattern, in
    which the operand is 1) converted to an unsigned type of the same width, and
    then 2) casted to an unsigned type of the wider width, and 3) finally casted
    to the target type.
    kroening committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    2b09504 View commit details
    Browse the repository at this point in the history