Previous: , Up: Arithmetic on poly_ints   [Contents][Index]


10.4.4 Other poly_int arithmetic

There are tentative routines for other operations besides division:

can_ior_p (a, b, &result)

Return true if we can calculate ‘a | b’ at compile time, storing the result in result if so.

Also, ANDs with a value ‘(1 << y) - 1’ or its inverse can be treated as alignment operations. See Alignment of poly_ints.

In addition, the following miscellaneous routines are available:

coeff_gcd (a)

Return the greatest common divisor of all nonzero coefficients in a, or zero if a is known to be zero.

common_multiple (a, b)

Return a value that is a multiple of both a and b, where one value is a poly_int and the other is a scalar. The result will be the least common multiple for some indeterminate values but not necessarily for all.

force_common_multiple (a, b)

Return a value that is a multiple of both poly_int a and poly_int b, asserting that such a value exists. The result will be the least common multiple for some indeterminate values but not necessarily for all.

When using this routine, please add a comment explaining why the assertion is known to hold.

Please add any other operations that you find to be useful.