1 /*
2     Copyright (C) 2015 Fredrik Johansson
3 
4     This file is part of Arb.
5 
6     Arb is free software: you can redistribute it and/or modify it under
7     the terms of the GNU Lesser General Public License (LGPL) as published
8     by the Free Software Foundation; either version 2.1 of the License, or
9     (at your option) any later version.  See <http://www.gnu.org/licenses/>.
10 */
11 
12 #include "arb_poly.h"
13 
14 void
arb_poly_add_si(arb_poly_t res,const arb_poly_t x,slong y,slong prec)15 arb_poly_add_si(arb_poly_t res, const arb_poly_t x, slong y, slong prec)
16 {
17     slong len = x->length;
18 
19     if (len == 0)
20     {
21         arb_poly_set_si(res, y);
22     }
23     else
24     {
25         arb_poly_fit_length(res, len);
26 
27         arb_add_si(res->coeffs, x->coeffs, y, prec);
28 
29         if (res != x)
30             _arb_vec_set(res->coeffs + 1, x->coeffs + 1, len - 1);
31 
32         _arb_poly_set_length(res, len);
33         _arb_poly_normalise(res);
34     }
35 }
36 
37