GNU Compiler Collection (GCC) Internals: wi arithmetic on poly_ints

Next: Division of `poly_int`s, Previous: Using `poly_int` with C++ arithmetic operators, Up: Arithmetic on `poly_int`s [Contents][Index]

#### 10.4.2 `wi` arithmetic on `poly_int`s

As well as the C++ operators, `poly_int` supports the following `wi` routines:

    wi::neg (p1, &overflow)

    wi::add (p1, p2)
    wi::add (p1, c2)
    wi::add (c1, p1)
    wi::add (p1, p2, sign, &overflow)

    wi::sub (p1, p2)
    wi::sub (p1, c2)
    wi::sub (c1, p1)
    wi::sub (p1, p2, sign, &overflow)

    wi::mul (p1, c2)
    wi::mul (c1, p1)
    wi::mul (p1, c2, sign, &overflow)

    wi::lshift (p1, c2)

These routines just check whether overflow occurs on any individual coefficient; it is not possible to know at compile time whether the final runtime value would overflow.