1 /*
2     Copyright (C) 2014 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.h"
13 
14 /* mag_mul_2exp_si is non-inline, but avoid overhead here */
15 static __inline__ void
_mag_mul_2exp_si(mag_t z,const mag_t x,slong y)16 _mag_mul_2exp_si(mag_t z, const mag_t x, slong y)
17 {
18     if (mag_is_special(x))
19     {
20         mag_set(z, x);
21     }
22     else
23     {
24         if (y >= ADD2_FAST_MIN && y <= ADD2_FAST_MAX)
25             _fmpz_add_fast(MAG_EXPREF(z), MAG_EXPREF(x), y);
26         else
27             fmpz_add_si(MAG_EXPREF(z), MAG_EXPREF(x), y);
28         MAG_MAN(z) = MAG_MAN(x);
29     }
30 }
31 
32 void
arb_mul_2exp_si(arb_t y,const arb_t x,slong e)33 arb_mul_2exp_si(arb_t y, const arb_t x, slong e)
34 {
35     arf_mul_2exp_si(arb_midref(y), arb_midref(x), e);
36     _mag_mul_2exp_si(arb_radref(y), arb_radref(x), e);
37 }
38 
39