1 /*
2     Copyright (C) 2008, 2009 William Hart
3     Copyright (C) 2010 Fredrik Johansson
4 
5     This file is part of FLINT.
6 
7     FLINT is free software: you can redistribute it and/or modify it under
8     the terms of the GNU Lesser General Public License (LGPL) as published
9     by the Free Software Foundation; either version 2.1 of the License, or
10     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
11 */
12 
13 #include <gmp.h>
14 #include "flint.h"
15 #include "fmpz.h"
16 #include "fmpz_vec.h"
17 
18 void
fmpz_factor_si(fmpz_factor_t factor,slong n)19 fmpz_factor_si(fmpz_factor_t factor, slong n)
20 {
21     _fmpz_factor_set_length(factor, 0);
22 
23     if (n < 0)
24     {
25         _fmpz_factor_extend_factor_ui(factor, -n);
26         factor->sign = -1;
27         return;
28     }
29     else
30     {
31         factor->sign = 1;
32         _fmpz_factor_extend_factor_ui(factor, n);
33     }
34 }
35