1 /*
2     Copyright (C) 2016 William Hart
3     Copyright (C) 2017 Daniel Schultz
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 <http://www.gnu.org/licenses/>.
11 */
12 
13 #include "fmpz_mpoly.h"
14 
fmpz_mpoly_set_ui(fmpz_mpoly_t A,ulong c,const fmpz_mpoly_ctx_t ctx)15 void fmpz_mpoly_set_ui(fmpz_mpoly_t A, ulong c, const fmpz_mpoly_ctx_t ctx)
16 {
17     slong N = mpoly_words_per_exp(A->bits, ctx->minfo);
18 
19     if (c == 0)
20     {
21         _fmpz_mpoly_set_length(A, 0, ctx);
22         return;
23     }
24 
25     N = mpoly_words_per_exp(A->bits, ctx->minfo);
26 
27     fmpz_mpoly_fit_length(A, 1, ctx);
28     fmpz_set_ui(A->coeffs + 0, c);
29     mpoly_monomial_zero(A->exps + N*0, N);
30     _fmpz_mpoly_set_length(A, 1, ctx);
31 }
32