You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Rust all primitive types provide a min_value and max_value constructor to constructor the minimum representable and maximum representable value respectively. In ApInt this is not directly possible since ApInt itself has no concept of signedness. However, it is possible to achieve a similar effect and provide the same level of functionality by providing constructors that are aware of the signedness.
The proposed API additions are:
fn signed_min_value(width: BitWidth) -> ApInt
Returns the smallest possible ApInt instance with the given BitWidth representing a signed value.
fn unsigned_min_value(width: BitWidth) -> ApInt
Returns the smallest possible ApInt instance with the given BitWidth representing an unsigned value.
fn signed_max_value(width: BitWidth) -> ApInt
Returns the largest possible ApInt instance with the given BitWidth representing a signed value.
fn unsigned_max_value(width: BitWidth) -> ApInt
Returns the largest possible ApInt instance with the given BitWidth representing an unsigned value.
Some higher level data structures that are based on ApInt may later use these explicit constructors in an implicit way. E.g. SignedApInt may provide min_value and max_value directly by simply forwarding to its internal ApInt::signed_min_value and ApInt::signed_max_value.
The text was updated successfully, but these errors were encountered:
In Rust all primitive types provide a
min_value
andmax_value
constructor to constructor the minimum representable and maximum representable value respectively. InApInt
this is not directly possible sinceApInt
itself has no concept of signedness. However, it is possible to achieve a similar effect and provide the same level of functionality by providing constructors that are aware of the signedness.The proposed API additions are:
fn signed_min_value(width: BitWidth) -> ApInt
fn unsigned_min_value(width: BitWidth) -> ApInt
fn signed_max_value(width: BitWidth) -> ApInt
fn unsigned_max_value(width: BitWidth) -> ApInt
Some higher level data structures that are based on
ApInt
may later use these explicit constructors in an implicit way. E.g.SignedApInt
may providemin_value
andmax_value
directly by simply forwarding to its internalApInt::signed_min_value
andApInt::signed_max_value
.The text was updated successfully, but these errors were encountered: