Next: Miscellaneous poly_int
routines, Previous: Computing bounds on poly_int
s, Up: poly_int [Contents][Index]
poly_int
sA poly_int<n, T>
can be constructed from up to
n individual T coefficients, with the remaining coefficients
being implicitly zero. In particular, this means that every
poly_int<n, T>
can be constructed from a single
scalar T, or something compatible with T.
Also, a poly_int<n, T>
can be constructed from
a poly_int<n, U>
if T can be constructed
from U.
The following functions provide other forms of conversion, or test whether such a conversion would succeed.
Return true if poly_int
value is a compile-time constant.
Return true if poly_int
value is a compile-time constant,
storing it in c1 if so. c1 must be able to hold all
constant values of value without loss of precision.
Assert that value is a compile-time constant and return its value. When using this function, please add a comment explaining why the condition is known to hold (for example, because an earlier phase of analysis rejected non-constants).
Return true if ‘poly_int<N, T>’ value can be
represented without loss of precision as a
‘poly_int<N, HOST_WIDE_INT
>’, storing it in that
form in p2 if so.
Return true if ‘poly_int<N, T>’ value can be
represented without loss of precision as a
‘poly_int<N, unsigned HOST_WIDE_INT
>’, storing it in that
form in p2 if so.
Forcibly convert each coefficient of ‘poly_int<N, T>’
value to HOST_WIDE_INT
, truncating any that are out of range.
Return the result as a ‘poly_int<N, HOST_WIDE_INT
>’.
Forcibly convert each coefficient of ‘poly_int<N, T>’
value to unsigned HOST_WIDE_INT
, truncating any that are
out of range. Return the result as a
‘poly_int<N, unsigned HOST_WIDE_INT
>’.
Return a poly_int
with the same value as value, but with
the coefficients converted from HOST_WIDE_INT
to wide_int
.
precision specifies the precision of the wide_int
cofficients;
if this is wider than a HOST_WIDE_INT
, the coefficients of
value will be sign-extended to fit.
Like wi::shwi
, except that value has coefficients of
type unsigned HOST_WIDE_INT
. If precision is wider than
a HOST_WIDE_INT
, the coefficients of value will be
zero-extended to fit.
Return a poly_int
of the same type as value, sign-extending
every coefficient from the low precision bits. This in effect
applies wi::sext
to each coefficient individually.
Like wi::sext
, but for zero extension.
Convert value to a poly_wide_int
in which each coefficient
has precision bits. Extend the coefficients according to
sign if the coefficients have fewer bits.
Convert value to a poly_offset_int
, extending its coefficients
according to sign if they have fewer bits than offset_int
.
Convert value to a poly_widest_int
, extending its coefficients
according to sign if they have fewer bits than widest_int
.
Next: Miscellaneous poly_int
routines, Previous: Computing bounds on poly_int
s, Up: poly_int [Contents][Index]