Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 static const char source_file[] = __FILE__;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 _X_PROP_TYPE_ *
00050 _X_PROP_CREATE_(
00051 INT32 universe_size,
00052 MEM_POOL *pool
00053 )
00054 {
00055
00056
00057
00058 UINT32 words = ( (universe_size + _X_PROP_TYPE_SIZE_ - 1)
00059 >> _X_PROP_TYPE_SIZE_LOG2_) + 1;
00060 _X_PROP_TYPE_ *prop = TYPE_MEM_POOL_ALLOC_N(_X_PROP_TYPE_, pool, words);
00061 if ( ! MEM_POOL_Zeroed(pool) ) bzero(prop, words * sizeof(_X_PROP_TYPE_));
00062 prop[0] = universe_size;
00063 return prop;
00064 }
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 void
00077 _X_PROP_SET_(
00078 _X_PROP_TYPE_ *prop,
00079 _X_PROP_LOCAL_BASE_TYPE_ x
00080 )
00081 {
00082 UINT32 id = _X_id_(x);
00083
00084 Is_True(id < prop[0], ("property id out of range"));
00085
00086 (prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_] |=
00087 (_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1));
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 void
00101 _X_PROP_RESET_(
00102 _X_PROP_TYPE_ *prop,
00103 _X_PROP_LOCAL_BASE_TYPE_ x
00104 )
00105 {
00106 UINT32 id = _X_id_(x);
00107
00108 Is_True(id < prop[0], ("property id out of range"));
00109
00110 (prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_] &=
00111 ~((_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1)));
00112 }
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 BOOL
00125 _X_PROP_GET_(
00126 _X_PROP_TYPE_ *prop,
00127 _X_PROP_LOCAL_BASE_TYPE_ x
00128 )
00129 {
00130 UINT32 id = _X_id_(x);
00131
00132 Is_True(id < prop[0], ("property id out of range"));
00133
00134 return ((prop+1)[id >> _X_PROP_TYPE_SIZE_LOG2_]
00135 & ((_X_PROP_TYPE_)1 << (id & (_X_PROP_TYPE_SIZE_-1)))) != 0;
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 void
00149 _X_PROP_UNIOND_(
00150 _X_PROP_TYPE_ *prop0,
00151 _X_PROP_TYPE_ *prop1
00152 )
00153 {
00154 UINT32 i;
00155 UINT32 universe_size = prop0[0];
00156 UINT32 words = (universe_size + _X_PROP_TYPE_SIZE_-1)
00157 >> _X_PROP_TYPE_SIZE_LOG2_;
00158
00159 Is_True(universe_size == prop1[0], ("vectors are different length"));
00160
00161 for ( i = 1; i <= words; ++i ) prop0[i] |= prop1[i];
00162 }
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 BOOL
00175 _X_PROP_INTERSECTION_IS_NONEMPTY_(
00176 _X_PROP_TYPE_ *prop0,
00177 _X_PROP_TYPE_ *prop1
00178 )
00179 {
00180 UINT32 i;
00181 UINT32 universe_size = prop0[0];
00182 UINT32 words = (universe_size + _X_PROP_TYPE_SIZE_-1)
00183 >> _X_PROP_TYPE_SIZE_LOG2_;
00184
00185 Is_True(universe_size == prop1[0], ("vectors are different length"));
00186
00187 for ( i = 1; i <= words; ++i ) {
00188 if ( (prop0[i] & prop1[i]) != 0 ) return TRUE;
00189 }
00190 return FALSE;
00191 }