blob: b641a9cbbe75650770313e30c5a9426ca7670f10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
/* Bit vector functions */
#ifndef CR_BITS_H
#define CR_BITS_H
#include "cr_compiler.h"
#define CR_MAX_CONTEXTS 512
#define CR_MAX_BITARRAY (CR_MAX_CONTEXTS / 32) /* 32 contexts per uint */
#ifdef __cplusplus
extern "C" {
#endif
static INLINE void RESET( unsigned int *b, const unsigned int *d )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
b[j] |= d[j];
}
static INLINE void DIRTY( unsigned int *b, const unsigned int *d )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
b[j] = d[j];
}
static INLINE void FILLDIRTY( unsigned int *b )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
b[j] = 0xffffffff;
}
static INLINE void CLEARDIRTY( unsigned int *b, const unsigned int *d )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
b[j] &= d[j];
}
/* As above, but complement the bits here instead of in the calling code */
static INLINE void CLEARDIRTY2( unsigned int *b, const unsigned int *d )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
b[j] &= ~d[j];
}
static INLINE int CHECKDIRTY( const unsigned int *b, const unsigned int *d )
{
int j;
for (j=0;j<CR_MAX_BITARRAY;j++)
if (b[j] & d[j])
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif
#endif /* CR_BITS_H */
|