1 //------------------------------------------------------------------------------
2 // GB_bitmap_assign_to_full:  make a full bitmap
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 // All entries in C are now present.  Either set all of C->b to 1, or free it
11 // and make C full.
12 
13 #include "GB_bitmap_assign_methods.h"
14 
GB_bitmap_assign_to_full(GrB_Matrix C,int nthreads_max)15 void GB_bitmap_assign_to_full   // set all C->b to 1, or free it and make C full
16 (
17     GrB_Matrix C,
18     int nthreads_max
19 )
20 {
21 
22     //--------------------------------------------------------------------------
23     // check inputs
24     //--------------------------------------------------------------------------
25 
26     ASSERT (GB_IS_BITMAP (C)) ;
27 
28     //--------------------------------------------------------------------------
29     // free the bitmap or set it to all ones
30     //--------------------------------------------------------------------------
31 
32     if (GB_sparsity_control (C->sparsity, C->vdim) & GxB_FULL)
33     {
34         // C is bitmap but can become full; convert it to full
35         GB_FREE (&(C->b), C->b_size) ;
36         C->nvals = -1 ;
37     }
38     else
39     {
40         // all entries in C are now present; C remains bitmap
41         int64_t cnzmax = C->vlen * C->vdim ;
42         GB_memset (C->b, 1, cnzmax, nthreads_max) ;
43         C->nvals = cnzmax ;
44     }
45 }
46 
47