satsolver
0.17.2
Main Page
Related Pages
Classes
Files
File List
File Members
src
bitmap.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007, Novell Inc.
3
*
4
* This program is licensed under the BSD license, read LICENSE.BSD
5
* for further information
6
*/
7
8
/*
9
* bitmap.c
10
*
11
*/
12
13
#include <stdlib.h>
14
#include <string.h>
15
16
#include "
bitmap.h
"
17
#include "
util.h
"
18
19
/* constructor */
20
void
21
map_init
(
Map
*m,
int
n)
22
{
23
m->
size
= (n + 7) >> 3;
24
m->
map
= m->
size
?
sat_calloc
(m->
size
, 1) : 0;
25
}
26
27
/* destructor */
28
void
29
map_free
(
Map
*m)
30
{
31
m->
map
=
sat_free
(m->
map
);
32
m->
size
= 0;
33
}
34
35
/* copy constructor t <- s */
36
void
37
map_init_clone
(
Map
*t,
Map
*s)
38
{
39
t->
size
= s->
size
;
40
if
(s->
size
)
41
{
42
t->
map
=
sat_malloc
(s->
size
);
43
memcpy(t->
map
, s->
map
, s->
size
);
44
}
45
else
46
t->
map
= 0;
47
}
48
49
/* grow a map */
50
void
51
map_grow
(
Map
*m,
int
n)
52
{
53
n = (n + 7) >> 3;
54
if
(m->
size
< n)
55
{
56
m->
map
=
sat_realloc
(m->
map
, n);
57
memset(m->
map
+ m->
size
, 0, n - m->
size
);
58
m->
size
= n;
59
}
60
}
61
62
/* EOF */
Generated by
1.8.4